Back to skill

Security audit

Agent Brain

Security checks for vulnerabilities and agentic risk

Overview

This memory skill is coherent, but it silently builds long-lived user and project memory and can mirror full memory entries to a cloud endpoint when credentials are present.

Install only if you want an agent to maintain persistent memory about you and your projects. Review or disable automatic extraction, set AGENT_BRAIN_SUPERMEMORY_SYNC=off unless cloud mirroring is intentionally approved, avoid storing secrets or regulated data, and inspect exported memory regularly because superseded and logged data can remain durable.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/brain.py:222
Finding

Automatic cloud mirroring can disclose persistent memory without explicit per-write consent

Content
View full analysis
str: return os.environ.get("AGENT_BRAIN_SUPERMEMORY_SYNC", "auto").strip().lower() def _supermemory_api_key() -> str: return os.environ.get("SUPERMEMORY_API_KEY", "").strip() def _maybe_sync_supermemory(entry: dict): mode = _supermemory_mode() if _is_falsy(mode): return api_key = _supermemory_api_key() if not api_key: if mode != "auto" and _is_truthy(os.environ.get("AGENT_BRAIN_SUPERMEMORY_DEBUG", "")): print("SuperMemory sync warning: SUPERMEMORY_API_KEY is not set", file=sys.stderr) return memory_payload = { "origin": "agent-brain", "entry_id": entry.get("id"), "type": entry.get("type"), "content": entry.get("content"), "source": entry.get("source"), "source_url": entry.get("source_url"), "tags": entry.get("tags", []), "context": entry.get("context"), "created": entry.get("created"), "confidence": entry.get("confidence"), "session_id": entry.get("session_id"), "correction_meta": entry.get("correction_meta"), } tags = [_sanitize_supermemory_tag("agent-brain"), _sanitize_supermemory_tag(entry.get("type", "entry"))] for tag in entry.get("tags", []): if len(tags) >= 8: break tags.append(_sanitize_supermemory_tag(tag)) tags = list(dict.fromkeys(tags)) req_payload = { "content": json.dumps(memory_payload, ensure_ascii=False), "customId": f"agent_brain_{entry.get('id', uuid.uuid4())}", "containerTags": tags, } api_url = os.environ.get( "SUPERMEMORY_API_URL", "https://api.supermemory.ai/v3/documents", ...[truncated 4384 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/brain.py:99
Finding

Incomplete and bypassable sensitive-data validation can expose secrets through storage and synchronization

Content
View full analysis
str: return os.environ.get("AGENT_BRAIN_PII_MODE", "strict").strip().lower() def is_sensitive_content(text: str) -> bool: if pii_mode() in {"off", "false", "0"}: return False patterns = [ r"-----BEGIN (RSA|EC|OPENSSH|PRIVATE) KEY-----", r"\bAKIA[0-9A-Z]{16}\b", r"\b(?:sk|rk|pk)_(?:live|test)?[A-Za-z0-9]{16,}\b", r"\bpassword\s*[:=]\s*\S+", r"\bapi[_-]?key\s*[:=]\s*\S+", r"\btoken\s*[:=]\s*\S+", r"\bsecret\s*[:=]\s*\S+", r"\bghp_[A-Za-z0-9]{20,}\b", ] return any(re.search(p, text, re.IGNORECASE) for p in patterns) ``` Validation is applied only to the main content during entry creation: ```python def build_entry( store, entry_type: str, content: str, source: str = "user", tags: list[str] | None = None, source_url: str | None = None, context: str | None = None, confidence: str | None = None, correction_meta: dict | None = None, ) -> dict: if is_sensitive_content(content): raise ValueError("Sensitive content detected; refusing to store.") ts = now_str() session = store.get_session() session_id = session["id"] if session else None entry_conf = confidence or ("sure" if source == "user" else "likely") return { "id": str(uuid.uuid4()), "type": entry_type, "memory_class": infer_memory_class(entry_type), "content": content, "source": source, "source_url": source_url if source_url else None, "tags": tags or [], "context": context if context else None, "se ...[truncated 4414 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
modules/ingest/SKILL.md:7
Finding

Prompt-only URL validation permits SSRF through DNS, redirects, and unhandled address ranges

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (37)

Tainted flow: 'request' from os.environ.get (line 280, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
97% confidence
Finding

The SuperMemory sync path sends stored memory fields including content, context, source_url, session_id, and correction metadata to a network endpoint whose URL is controllable via environment variables. In a memory skill handling user-entered data, this creates a real exfiltration path and SSRF-like risk, especially because the PII screening is heuristic and incomplete and the feature is only loosely disclosed as 'optional'.

Content

Scanner excerpt · scripts/brain.py (reported line 289)May include surrounding context.

python
},
            method="POST",
        )
        with urllib.request.urlopen(request, timeout=timeout) as response:
            if response.status >= 300 and debug:
                print(f"SuperMemory sync warning: HTTP {response.status}", file=sys.stderr)
    except urllib.error.HTTPError as exc:

Tainted flow: 'req' from os.environ.get (line 427, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
96% confidence
Finding

The remote embedding feature transmits query text and every active memory entry's content to an externally configured URL, also sourced from environment configuration. That is a genuine data-leakage channel and can also be abused for SSRF or sending sensitive conversation-derived content to an untrusted service without robust validation or disclosure.

Content

Scanner excerpt · scripts/brain.py (reported line 429)May include surrounding context.

python
timeout = float(os.environ.get("AGENT_BRAIN_EMBEDDING_TIMEOUT", "6"))
    req = urllib.request.Request(url, data=payload, headers=headers, method="POST")
    try:
        with urllib.request.urlopen(req, timeout=timeout) as resp:
            body = json.loads(resp.read().decode("utf-8"))
            if isinstance(body, dict) and isinstance(body.get("embedding"), list):
                vec = body["embedding"]

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents a fairly advanced local-first memory system centered on SQLite storage plus higher-level orchestration and retrieval behaviors. This code chunk instead provides a legacy JSON-backed persistence layer. Its behavior is limited to CRUD-style storage operations, schema migration, session/meta tracking, activity logging, supersession markers, and decay hooks. Those are related to memory persistence, so the domain is adjacent, but the storage resource is materially different (JSON file vs SQLite), and the advertised advanced capabilities are not present in this code. Therefore the description does not accurately represent what this specific supplied code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description describes a sophisticated persistent memory skill with storage, retrieval orchestration, and learning features. The provided code instead only validates metadata structure in a JSON file. Its primary purpose is entirely different and unrelated to the declared memory-system behavior. There is no evidence of SQLite usage, agent memory management, retrieval loops, contradiction checks, correction learning, or SuperMemory mirroring.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Directing the agent to extract and persist information from every user message creates a covert data collection channel. In context, the skill is specifically built to accumulate long-lived user, project, preference, and workflow data, so the risk is not incidental but core to operation and can capture secrets, internal architecture, and personal information over time.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The workflow explicitly says to scan every message, check conflicts, and then add user-derived content while keeping extraction silent. This creates sustained privacy and data-governance risk because users are not told that ordinary conversation is being converted into durable records, potentially including sensitive technical and behavioral data.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 173)May include surrounding context.

md
All operations go through `scripts/memory.sh` → `scripts/brain.py` with a pluggable

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 326)May include surrounding context.

md
All operations go through `scripts/memory.sh` → `scripts/brain.py` with a pluggable

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill requires fact extraction from every user message but does not pair that requirement with a clear privacy warning or consent model. Systematic capture of user data from all messages materially increases privacy risk because users may disclose personal or organizational information incidentally, not expecting long-term retention.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This section operationalizes broad surveillance-style collection by directing the agent to actively scan every message, classify extractable personal and project information, and persist it silently. In the context of a persistent SQLite-backed memory system, this is especially dangerous because it normalizes covert profiling and retention of sensitive contextual data at scale.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly instructs the agent to store user-derived information silently and to avoid telling the user that retention is happening. That creates a privacy and consent problem, especially because the stored data includes preferences, identity, work, and project details that may persist across sessions without meaningful notice.

Content

No source excerpt is available for this finding.

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
86% confidence
Finding

The instruction 'Don't add caveats or disclaimers' for frustrated users can suppress safety-relevant qualifiers precisely when nuanced limitations, risks, or uncertainty should be communicated. In practice this can bias the agent toward overly direct answers that omit warnings, constraints, or refusal language, increasing the chance of unsafe or non-compliant assistance.

Content

Scanner excerpt · modules/vibe/SKILL.md (reported line 27)May include surrounding context.

md
### Frustrated
- Don't over-explain
- Don't add caveats or disclaimers
- Lead with the fix
- Skip "Great question!" pleasantries

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/benchmark.sh (reported line 19)May include surrounding context.

sh
[[ -f "$MEMORY_DIR/memory.json" ]] && cp "$MEMORY_DIR/memory.json" "$BACKUP_JSON"

cleanup() {
  rm -f "$MEMORY_DIR/memory.db" "$MEMORY_DIR/memory.json" "$MEMORY_DIR/memory.json.bak"
  [[ -f "$BACKUP_DB" ]] && mv "$BACKUP_DB" "$MEMORY_DIR/memory.db"
  [[ -f "$BACKUP_JSON" ]] && mv "$BACKUP_JSON" "$MEMORY_DIR/memory.json"
}

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/benchmark.sh (reported line 66)May include surrounding context.

sh
[[ -f "$MEMORY_DIR/memory.json" ]] && cp "$MEMORY_DIR/memory.json" "$BACKUP_JSON"

cleanup() {
  rm -f "$MEMORY_DIR/memory.db" "$MEMORY_DIR/memory.json" "$MEMORY_DIR/memory.json.bak"
  [[ -f "$BACKUP_DB" ]] && mv "$BACKUP_DB" "$MEMORY_DIR/memory.db"
  [[ -f "$BACKUP_JSON" ]] && mv "$BACKUP_JSON" "$MEMORY_DIR/memory.json"
}

Ssd 3

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

User-provided memory content is packaged and sent in plain form to an external API, while the sensitive-content detector only covers a narrow set of patterns and misses many forms of PII, credentials, and proprietary text. In a long-lived memory system, even non-secret snippets can accumulate into highly sensitive profiles, making partial screening insufficient.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The embedding request sends raw input text for queries and memory entries to a remote endpoint, exposing conversation-derived semantics and potentially sensitive content. Because embeddings are computed over all active entries, the leakage scope can include the entire memory corpus, not just the current query.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/test_memory.sh (reported line 177)May include surrounding context.

sh
assert_export_field ".get('current_session')" "None" "init sets current_session to null"
meta_check=$("$SCRIPT_DIR/validate_meta.sh" 2>&1)
assert_contains "$meta_check" "Metadata valid" "metadata JSON validates"
if grep -q "../../supermemory/.env" "$MEMORY_SH"; then
  fail "memory.sh is standalone" "Found cross-skill env path ../../supermemory/.env"
else
  pass "memory.sh is standalone"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/test_memory.sh (reported line 178)May include surrounding context.

sh
assert_export_field ".get('current_session')" "None" "init sets current_session to null"
meta_check=$("$SCRIPT_DIR/validate_meta.sh" 2>&1)
assert_contains "$meta_check" "Metadata valid" "metadata JSON validates"
if grep -q "../../supermemory/.env" "$MEMORY_SH"; then
  fail "memory.sh is standalone" "Found cross-skill env path ../../supermemory/.env"
else
  pass "memory.sh is standalone"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill describes capabilities that require file access, environment-variable access, and optional network transmission, but it does not declare any tool scope or permissions boundaries. That omission increases the chance an agent runtime grants broader access than users expect, especially because the skill persists user data and may sync it externally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill instructs the agent to retain and use user information without explicit, user-facing notice or consent. Silent memory capture undermines informed consent and can cause privacy harm, especially when users share sensitive project, personal, or operational details assuming only ephemeral processing.

Content

No source excerpt is available for this finding.

Ssd 4

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The retrieve-then-silent-extract loop promotes progressive profiling: prior stored data silently shapes responses while new data is silently added each turn. That combination increases user trust while hiding the extent of retention, making long-term privacy harm and unanticipated secondary use more likely.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill describes optional cloud mirroring of stored memory but does not present a prominent warning or consent flow to users whose data may be sent to an external service. Because the memory system is designed to collect facts from normal conversation, external sync materially raises confidentiality and compliance risk.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

The documented default external endpoint enables transmission of retained memory to a third-party service when sync is enabled or auto-detected via API key. In this skill's context, the transmitted data may include accumulated conversational facts, preferences, workflows, and project details, so outbound transfer meaningfully expands the attack surface and confidentiality risk.

Content

Scanner excerpt · SKILL.md (reported line 188)May include surrounding context.

AGENT_BRAIN_SUPERMEMORY_SYNC=on (force sync attempt) AGENT_BRAIN_SUPERMEMORY_SYNC=off (disable sync) SUPERMEMORY_API_KEY=... (required for auto/on) SUPERMEMORY_API_URL=... (optional; default https://api.supermemory.ai/v3/documents) AGENT_BRAIN_SUPERMEMORY_TIMEOUT=8 (optional timeout seconds) AGENT_BRAIN_SUPERMEMORY_DEBUG=1 (optional sync warnings to stderr)

text

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The instruction to silently apply retrieved memory without disclosing that it came from stored records makes the agent's personalization opaque. That undermines informed user control and can conceal the extent of historical profiling, especially when prior stored data influences responses in ways the user cannot audit or challenge.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrase "Summarize what you've read" is broad enough to match ordinary conversation rather than a clearly scoped ingest-memory command. In an agent skill context, that ambiguity can cause unintended invocation of the ingest module and disclosure or aggregation of previously ingested content without the user explicitly requesting this specific capability.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dynamic_code_execution

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
scripts/test_memory.sh:80