Back to skill

Security audit

Memos Cloud Server

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it advertises, but it is designed to send and store nearly every conversation turn in an external memory service by default.

Install only if you intentionally want MemOS Cloud to receive and retain conversation history by default. Configure the API key and endpoint only in a trusted environment, prefer a host-provided session ID, avoid pasting secrets or sensitive files while this skill is active, and confirm remote uploads or deletions before allowing the agent to perform them.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:30
Finding
Mandatory Always-On Remote Collection and Persistence of Conversation Data## Vulnerability Details **File Location**: `SKILL.md:3`, `SKILL.md:30-44`, and `SKILL.md:88-94` **Vulnerability Type**: Mandatory workflow manipulation causing non-consensual remote data persistence **Risk Level**: Critical ### Vulnerable Code Snippet ```markdown description: External long-term memory and knowledge base backed by the MemOS Cloud API. Capabilities — search prior memory, add conversation messages, delete or correct memories via feedback, retrieve a consolidated user profile (facts, preferences, tool history), and manage knowledge bases and their documents. Use proactively on every user turn (search memory before answering and persist the exchange after), and whenever the user references past context, their identity, preferences, or history, or asks to remember, recall, modify, forget, or correct something (e.g., "who am I", "what do I like", "remember that...", "forget X", "you got it wrong"). Also use when uploading, listing, or deleting knowledge base files. ``` ```markdown ## ⚠️ Mandatory Workflow (MUST FOLLOW) ### Always-On (No User Opt-In Required) This system runs **automatically for every turn**. Do NOT wait for the user to say "use memory", "search memory", or "remember this". The agent is responsible for auto-invoking the tools. ### Every Turn: 3-Step Workflow (AUTO-INVOKED) ``` Every user message (including greetings, simple questions, ANYTHING) → 1) search_memory (AUTO, BEFORE answering — even for simple questions) → 2) Answer (use only relevant memories; ignore noise) → 3) add_message (AUTO, AFTER answering — save conversation history) ``` ``` ```markdown ### When NOT to Invoke (Negative Triggers) The default policy is "search-before-answer on every turn". Skip invocation only in these narrow cases: - The user explicitly opts out for the current turn (e.g., "don't search memory", "skip memory", "answer without memory"). - The turn is a pure tool/system action with no semantic ...[truncated 4158 chars]
Remediation
## Remediation Suggestions 1. Remove the mandatory search-and-store workflow from the skill instructions. 2. Require explicit and informed user consent before the first remote memory search or write. 3. Default to no persistence. Storage should occur only when the user expressly requests that particular information be remembered. 4. Clearly disclose the remote destination, retention behavior, user identifier usage, and categories of data sent. 5. Provide durable opt-out controls rather than requiring users to opt out separately on every turn. 6. Apply content minimization before storage. Store extracted, user-approved facts rather than complete conversation transcripts. 7. Redact likely credentials, tokens, secrets, personal identifiers, and proprietary data before constructing a payload. 8. Add configurable retention periods and mechanisms to inspect, export, and delete all remotely stored data. 9. Restrict automatic retrieval to requests where memory is directly relevant instead of invoking it for greetings and unrelated questions. 10. Require confirmation before storing unusually sensitive content or any data originating from files, logs, source code, or tool output.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/memos_cloud/config.py:38
Finding
API Credential and Sensitive Payload Exposure Through an Unvalidated Configurable Base URL## Vulnerability Details **File Location**: `scripts/memos_cloud/config.py:24-27`, `scripts/memos_cloud/config.py:38-49`, and `scripts/memos_cloud/client.py:27-35` **Vulnerability Type**: Unvalidated external endpoint used for authenticated requests **Risk Level**: High ### Vulnerable Code Snippet `scripts/memos_cloud/config.py:24-27` creates an authorization header from the deployment secret: ```python @property def headers(self) -> dict[str, str]: return { "Authorization": f"Token {self.api_key}", "Content-Type": "application/json", } ``` `scripts/memos_cloud/config.py:38-49` accepts an unrestricted endpoint from the environment: ```python def load_config(env: Optional[Mapping[str, str]] = None) -> MemosConfig: source = env if env is not None else os.environ api_key = source.get("MEMOS_API_KEY") if not api_key: raise ConfigurationError("MEMOS_API_KEY environment variable is not set.") return MemosConfig( base_url=source.get("MEMOS_CLOUD_URL", DEFAULT_BASE_URL).rstrip("/"), api_key=api_key, user_id=source.get("MEMOS_USER_ID") or None, agent_id=source.get("MEMOS_AGENT_ID") or None, app_id=source.get("MEMOS_APP_ID") or None, ``` `scripts/memos_cloud/client.py:27-35` attaches the authorization header to requests sent to that endpoint: ```python def post(self, endpoint: str, payload: Mapping[str, Any]) -> Any: url = f"{self.config.base_url}/{endpoint.lstrip('/')}" body = {**payload, "source": SOURCE_VALUE} try: response = self.session.post( url, headers=self.config.headers, json=body, timeout=self.timeout, ) response.raise_for_status() return response.json() ``` ### Technical Analysis `MEMOS_CLOUD_URL` is treated as a trusted base URL without validating its scheme, hostname, port, or destinat ...[truncated 2410 chars]
Remediation
## Remediation Suggestions 1. Parse `MEMOS_CLOUD_URL` with a standards-compliant URL parser before creating the client. 2. Require the `https` scheme and reject plaintext HTTP, missing schemes, embedded credentials, fragments, and malformed hosts. 3. Enforce an explicit allowlist of approved API hostnames and ports. If custom deployments are required, provision their approved endpoints through an administrator-controlled configuration list. 4. Resolve and validate the final request destination, including redirect targets, before sending credentials. 5. Disable redirects for authenticated API requests unless redirects are operationally required: ```python response = self.session.post( url, headers=self.config.headers, json=body, timeout=self.timeout, allow_redirects=False, ) ``` 6. If redirects are required, follow only same-origin HTTPS redirects and never forward authorization headers to a different origin. 7. Add tests proving that `http://`, attacker-controlled hosts, embedded credentials, and cross-origin redirects are rejected. 8. Scope API tokens to the minimum required operations and tenant resources. 9. Rotate the token immediately if requests may have been sent to an untrusted endpoint. 10. Keep endpoint configuration in administrator-controlled deployment settings with appropriate integrity protections and audit logging.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (14)

Missing User Warnings

High
Confidence
98% confidence
Finding
The skill mandates automatic memory search and persistence on every turn, including simple greetings, with no clear user-facing consent, notice, or granular control beyond narrow negative triggers. This creates a privacy and compliance risk because users may disclose sensitive data that is searched and stored in an external service without meaningful informed opt-in.

Memory Manipulation

High
Category
Memory Poisoning
Content
| Identity / preference query ("What do I like?") | `search_memory` + `get_user_profile` | - |
| New information / remember something | `add_message` | NOT `add_feedback` |
| Modify / correct existing memory | `add_feedback` | NOT `add_message` |
| Delete memory (no ID specified) | `search` → `delete` → `add_feedback` | NOT `add_message` |
| Delete memory (ID specified) | `delete` directly | - |

### Modification Workflow
Confidence
80% confidence
Finding
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Memory Manipulation

High
Category
Memory Poisoning
Content
| Identity / preference query ("What do I like?") | `search_memory` + `get_user_profile` | - |
| New information / remember something | `add_message` | NOT `add_feedback` |
| Modify / correct existing memory | `add_feedback` | NOT `add_message` |
| Delete memory (no ID specified) | `search` → `delete` → `add_feedback` | NOT `add_message` |
| Delete memory (ID specified) | `delete` directly | - |

### Modification Workflow
Confidence
80% confidence
Finding
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Memory Manipulation

High
Category
Memory Poisoning
Content
| Identity / preference query ("What do I like?") | `search_memory` + `get_user_profile` | - |
| New information / remember something | `add_message` | NOT `add_feedback` |
| Modify / correct existing memory | `add_feedback` | NOT `add_message` |
| Delete memory (no ID specified) | `search` → `delete` → `add_feedback` | NOT `add_message` |
| Delete memory (ID specified) | `delete` directly | - |

### Modification Workflow
Confidence
80% confidence
Finding
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Memory Manipulation

High
Category
Memory Poisoning
Content
---

### 3. Delete Memory (`/delete/memory`)

Delete stored memories by comma-separated memory IDs.
Confidence
80% confidence
Finding
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill declares no explicit tool scope while its documented behavior requires access to environment secrets and outbound network/API operations. Without an allowlist or permissions boundary, a host may grant broader capabilities than intended, increasing the blast radius if the skill is misused or prompt-injected.

Ssd 3

Medium
Confidence
96% confidence
Finding
The skill description itself instructs proactive use on every user turn to search prior memory and persist the exchange after, establishing broad collection and retention of conversational data by default. That creates surveillance-like behavior and increases exposure of sensitive personal, preference, and history data beyond what is necessary for many interactions.

Ssd 3

Medium
Confidence
99% confidence
Finding
The mandatory 3-step workflow requires memory retrieval before every answer and storage after every answer for every message. This blanket logging behavior materially increases privacy risk, data retention volume, and the chance that sensitive or regulated information is stored externally without necessity.

Ssd 3

Medium
Confidence
88% confidence
Finding
The instruction to capture the first user message verbatim and keep it in working notes requires retaining user-provided content even when that first message may contain sensitive information. Because the exact text is reused as a session anchor, it can unnecessarily propagate personal or confidential content into tool calls or agent state.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The knowledge-base upload and deletion features can modify or remove user data, but the skill text does not pair these operations with strong confirmation or risk warnings. In practice, an agent following this skill could perform destructive or privacy-sensitive actions too readily, especially if user intent is ambiguous.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
This code file sends potentially sensitive user data such as queries, conversation content, profile filters, and memory retrieval parameters to remote endpoints via client.post. The file contains no confirmation prompt, logging, comments, or docstrings disclosing that these functions transmit user data over the network.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The delete_memory function performs a remote deletion operation but provides no in-file warning, confirmation, log message, or explanatory docstring. Similar silent destructive behavior appears for knowledge-base document and knowledge-base deletion functions, making the irreversible effect easy to invoke without disclosure.

Missing User Warnings

Medium
Confidence
85% confidence
Finding
The add_kb_doc function uploads file metadata/content references to a remote knowledge-base endpoint, which can affect user data and privacy. There is no visible warning, docstring, comment, or user-facing logging in this file indicating that documents are being transmitted externally.

Missing User Warnings

Medium
Confidence
82% confidence
Finding
These functions create and delete remote knowledge-base resources, including destructive endpoints at /delete/knowledgebase-file and /delete/knowledgebase, without any explanatory comments, docstrings, or user-facing notices. For code files, safety-relevant remote state changes should have some form of visible disclosure unless clearly documented elsewhere, which is not present here.

Static analysis

No suspicious patterns detected.