Back to skill

Security audit

BrainX V5 — The First Brain for OpenClaw

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed memory system, but it automatically captures, shares, and injects broad cross-agent memories and can promote them into startup instruction files, so it needs careful review before installation.

Install only if you intentionally want a shared, persistent agent memory system with startup injection and are prepared to manage it like sensitive infrastructure. Disable unattended promotion into AGENTS.md, TOOLS.md, and SOUL.md unless every rule is reviewed, avoid storing personal or financial data by default, encrypt or exclude secrets from backups, and warn users that search and memory content may be sent to OpenAI for embeddings.

Vulnerability Patterns
  • 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
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (4)

T02 · Agent Memory Poisoning

Error
Location
hook/handler.js:128
Finding

Untrusted Cross-Agent Memories Are Persistently Injected into Privileged Bootstrap Context

Content
View full analysis
{ const ownFilter = agentName ? `AND (agent = $3 OR agent IS NULL)` : ''; const ownParams = agentName ? [minImportance, ownSlots, agentName] : [minImportance, ownSlots]; const { rows: ownRows } = await pool.query( `SELECT content, tier, importance, type, agent, context FROM brainx_memories WHERE tier IN ('hot', 'warm') AND importance >= $1 AND superseded_by IS NULL ${ownFilter} ORDER BY importance DESC, last_seen DESC NULLS LAST, created_at DESC LIMIT $2`, ownParams ); const crossFilter = agentName ? `AND agent IS DISTINCT FROM $3 AND agent IS NOT NULL` : ''; const crossParams = agentName ? [minImportance, crossSlots, agentName] : [minImportance, crossSlots]; const { rows: crossRows } = await pool.query( `SELECT content, tier, importance, type, agent, context FROM brainx_memories WHERE tier IN ('hot', 'warm') AND importance >= $1 AND superseded_by IS NULL ${crossFilter} ORDER BY CASE WHEN 'cross-agent' = ANY(tags) THEN 1 ELSE 0 END DESC, importance DESC, last_seen DESC NULLS LAST, created_at DESC LIMIT $2`, crossParams ); return [...ownRows, ...crossRows]; }, "queryTopMemories"); } ``` ```js function buildMemorySection(agentName, timestamp, teamMems, ownMems) { const lines = [BRAINX_START, ...[truncated 4532 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
README.md:253
Finding

Scheduled Auto-Promotion Can Convert Learned Content into Permanent Agent Instructions

Content
View full analysis
> logs/cross-agent.log 2>&1 30 3 * * * cd /path/to/brainx-v5 && node scripts/contradiction-detector.js >> logs/contradiction.log 2>&1 0 4 * * * cd /path/to/brainx-v5 && node scripts/quality-scorer.js >> logs/quality.log 2>&1 15 4 * * * cd /path/to/brainx-v5 && node scripts/auto-promoter.js --save >> logs/auto-promoter.lo ...[truncated 2740 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
lib/openai-rag.js:267
Finding

Search Queries Are Sent to OpenAI Before Secret and PII Redaction

Content
View full analysis
$1::vector) AS similarity FROM brainx_memories WHERE importance >= $2 AND superseded_by IS NULL AND (expires_at IS NULL OR expires_at > NOW()) AND embedding IS NOT NULL `; ``` ```js async function embed(text) { const cfg = getOpenAIConfig(); if (text === null || text === undefined) { throw new Error('embed() requires a non-null/undefined input'); } const inputText = typeof text === 'string' ? text : String(text); let lastError; for (let attempt = 0; attempt < MAX_RETRIES; attempt++) { try { const res = await fetch('https://api.openai.com/v1/embeddings', { method: 'POST', headers: { Authorization: `Bearer ${cfg.apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: cfg.model, input: inputText, dimensions: cfg.dimensions }) }); ``` ### Technical Analysis `search()` passes the raw search query to `embed()`. The embedding client then transmits that text to the OpenAI embeddings endpoint. The ...[truncated 1792 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:225
Finding

Backup Guidance Includes Plaintext Credential Files in Archives

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (126)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The README normalizes broad automated collection, storage, and sharing of sensitive session data, including personal and financial information, without a prominent privacy warning or meaningful consent boundary. Users and operators may not understand that full transcripts are mined and reused across agents, increasing the likelihood of silent overcollection and disclosure.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The README explicitly states that the LLM distiller reads full session transcripts and extracts personal, technical, and financial data into persistent memory. Combined with automatic sharing and injection, this creates a high-risk pipeline for retaining and redistributing sensitive information far beyond the immediate session where it was provided.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Automatically writing permanent behavioral rules into AGENTS.md, TOOLS.md, and SOUL.md without human review is a strong persistence mechanism. Because future agents read those files at startup, any bad promotion can continuously steer behavior, amplify prompt injection, or institutionalize incorrect or unsafe operational practices.

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 · README.md (reported line 509)May include surrounding context.

md
pnpm install  # or npm install

# 3. Configure environment
cp .env.example .env
# Edit: DATABASE_URL, OPENAI_API_KEY

# 4. Database setup (requires PostgreSQL with pgvector)

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The documentation explicitly frames personal, financial, contact, and health information as reusable facts for future agents to use without asking again. That encourages persistent storage and broad reuse of highly sensitive data, undermining confidentiality and user expectations across sessions and agents.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

Automatic propagation and startup injection of memories derived from full transcripts creates persistent, repeated exposure of sensitive information. Because injected context is surfaced to agents at bootstrap, sensitive details can be needlessly replicated into prompts and become available to tools, logs, and downstream model providers.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

rm -rf ~/.openclaw is a classic parameter-abuse pattern because recursive forced deletion on a home-directory subtree can irreversibly remove application state and secrets. In this skill's context, that includes hooks, environment files, and operational configs required for recovery, making the guidance more dangerous than a generic example.

Content

Scanner excerpt · RESILIENCE.md (reported line 58)May include surrounding context.

Qué pasa:

bash
# El usuario ejecuta:
rm -rf ~/.openclaw
# o
openclaw reset --hard

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

rm -rf ~/.openclaw is a classic parameter-abuse pattern because recursive forced deletion on a home-directory subtree can irreversibly remove application state and secrets. In this skill's context, that includes hooks, environment files, and operational configs required for recovery, making the guidance more dangerous than a generic example.

Content

Scanner excerpt · RESILIENCE.md (reported line 58)May include surrounding context.

Qué pasa:

bash
# El usuario ejecuta:
rm -rf ~/.openclaw
# o
openclaw reset --hard

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The guide recommends syncing backups to cloud storage but elsewhere states the backup archive contains openclaw.env, database dumps, and potentially API keys and database credentials. Encouraging cloud replication without encryption or credential-handling warnings materially increases the risk of credential exposure and full data compromise if the remote storage is misconfigured or accessed by unauthorized parties.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The guide explicitly tells users to run grep -E "DATABASE_URL|OPENAI_API_KEY" ~/.openclaw/.env, which prints sensitive credentials to the terminal and likely shell logs, screenshots, session transcripts, or monitoring systems. In an LLM-agent environment, outputting secrets is especially dangerous because surrounding tooling may capture and persist command output automatically.

Content

Scanner excerpt · RESILIENCE.md (reported line 251)May include surrounding context.

cat ~/.openclaw/workspace-clawma/BRAINX_CONTEXT.md

4. Verificar variables de entorno

grep -E "DATABASE_URL|OPENAI_API_KEY" ~/.openclaw/.env

text

### Restauración rápida (emergencia)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The code does use vector-memory-related components: it queries relevant memories through a RAG/embedding search path and uses PostgreSQL-backed storage. However, the primary behavior of this chunk is not a generic memory engine that stores, searches, and injects contextual memories into prompts. Instead, it is a specific advisory subsystem that runs before agent tool actions, aggregates memories plus trajectories and patterns, formats human-readable warnings/advice, stores advisory events, and collects feedback. Those are materially different capabilities from the declared description, and key advertised features like auto-injection hooks and backup/recovery are not represented in this code chunk. Therefore this chunk does not accurately match the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code substantially matches the core memory-engine description in that it provides CLI operations to add, search, and inject memories, and it interfaces with database and RAG components consistent with PostgreSQL/pgvector/OpenAI-based memory retrieval. However, the declared description omits significant additional capabilities exposed here: an advisory subsystem and an EIDOS prediction/evaluation/learning loop, both of which go beyond simple memory storage/search/injection. Also, two specifically declared features are not supported by this chunk: a full backup/recovery system and an auto-injection hook for OpenClaw are not visible here beyond reading an OPENCLAW_AGENT env var. Because the actual code exposes materially different and additional primary capabilities while missing notable declared ones in this chunk, this should be flagged as a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents the skill as a vector memory engine whose main functions are storing/searching memories, injecting context into prompts, and providing backup/recovery. The supplied code does not implement those core behaviors. Instead, it is a doctor/diagnostic command that audits database connectivity, pgvector installation, schema columns/constraints/indexes, data integrity, duplicate candidates, cron configuration, deployed hook presence, CLI presence, and backup freshness, then prints a report. While some checks relate to the described system components (pgvector, auto-injection hook, backups), the primary purpose of this code chunk is operational diagnostics and infrastructure validation, which is materially different from the declared core functionality.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description centers on a vector memory engine for storing/searching memories and injecting them into prompts, plus auto-injection and backup/recovery. This code chunk does not implement memory search, prompt injection hooks, embeddings, pgvector operations, or backup/recovery. Instead, its primary purpose is a prediction→evaluation→learning workflow for agent self-improvement, backed by a separate brainx_eidos_cycles table. While it does call rag.storeMemory to save a distilled learning as a memory, that is only a secondary integration point and does not make the chunk a vector memory engine. Therefore the behavior is materially different from the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents the skill as a vector memory engine focused on storing/searching/injecting memories and backup/recovery. The supplied code chunk does not implement memory storage, search, prompt injection, or backup/recovery. Instead, it is a maintenance/fix utility (fix.js) that performs database repair and housekeeping tasks and reads local filesystem state for migrations and cron configuration. While regenerating embeddings and deduplication are related to a memory engine, the primary purpose of this code is operational repair, not the declared core functionality. Therefore the description does not accurately represent this code chunk's behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

The code clearly matches part of the description: it stores memories, creates embeddings, performs vector similarity search via pgvector, and uses PostgreSQL-backed persistence. However, the declared description includes additional major capabilities not evidenced here: there is no code that injects retrieved memories into LLM prompts, no OpenClaw hook/integration, and no backup or recovery functionality. Those are material declared features, not minor implementation details. Conversely, the code includes substantial behavior not mentioned in the description, notably PII scrubbing/redaction, semantic/pattern deduplication and merge behavior, lifecycle/provenance tracking, and query-event logging. The largest issue is that the description overstates the implemented capabilities in this chunk, so this should be flagged as a mismatch.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The backup/restore section omits strong warnings that backups may include sensitive configuration and that restore with --force can destructively replace existing state. Users could unintentionally leak secrets in archives or irreversibly overwrite valid environments and workspaces.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% 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 · SKILL.md (reported line 308)May include surrounding context.

bash
# Check for advisories before a tool execution
./brainx-v5 advisory --tool exec --args '{"command":"rm -rf /tmp/old"}' --agent coder --json

# Quick check via helper script
./scripts/advisory-check.sh exec '{"command":"rm -rf /tmp/old"}' coder

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% 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 · SKILL.md (reported line 311)May include surrounding context.

bash
# Check for advisories before a tool execution
./brainx-v5 advisory --tool exec --args '{"command":"rm -rf /tmp/old"}' --agent coder --json

# Quick check via helper script
./scripts/advisory-check.sh exec '{"command":"rm -rf /tmp/old"}' coder

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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 · SKILL.md (reported line 308)May include surrounding context.

bash
# Check for advisories before a tool execution
./brainx-v5 advisory --tool exec --args '{"command":"rm -rf /tmp/old"}' --agent coder --json

# Quick check via helper script
./scripts/advisory-check.sh exec '{"command":"rm -rf /tmp/old"}' coder

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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 · SKILL.md (reported line 311)May include surrounding context.

bash
# Check for advisories before a tool execution
./brainx-v5 advisory --tool exec --args '{"command":"rm -rf /tmp/old"}' --agent coder --json

# Quick check via helper script
./scripts/advisory-check.sh exec '{"command":"rm -rf /tmp/old"}' coder

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `child_process.execFile` | `hook/handler.js` | Invokes the BrainX CLI to query memories during agent bootstrap. No arbitrary command execution. |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `child_process.execFile` | `hook/handler.js` | Invokes the BrainX CLI to query memories during agent bootstrap. No arbitrary command execution. |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `process.env` access | `lib/db.js`, `lib/openai-rag.js`, `lib/cli.js` | Reads `DATABASE_URL` and `OPENAI_API_KEY` to connect to PostgreSQL and generate embedd

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `process.env` access | `lib/db.js`, `lib/openai-rag.js`, `lib/cli.js` | Reads `DATABASE_URL` and `OPENAI_API_KEY` to connect to PostgreSQL and generate embedd