Back to skill

Security audit

BrainDB

Security checks for vulnerabilities and agentic risk

Overview

This memory skill fits its stated purpose in part, but it needs Review because it can expose and alter long-term memories through under-disclosed external Gemini calls, broad local environment capture, and weakly protected local services.

Review this carefully before installing. Use it only if you are comfortable with a persistent memory service that can store personal and business context, modify OpenClaw configuration, run Docker services, and potentially send memory/query/conversation data to Gemini when a key is present. Prefer a local-only configuration with authentication enabled, do not run the execution-awareness encoder until you inspect its proposed memories, and verify the release artifact before running install scripts.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
Findings (7)

other

Error
Location
gateway.js:896
Finding

Undisclosed Transmission of Persistent Memories and Conversation Data to Google Gemini

Content
View full analysis
`[${i}] ${c.trigger || ''}: ${(c.content || '').slice(0, 150)}` ).join('\n'); const geminiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${GEMINI_KEY}`; const res = await fetch(geminiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ contents: [{ parts: [{ text: `${SHARD_ROUTER_PROMPTS[shardType]} QUERY: "${query}" CANDIDATES: ${candidateList} ``` The auto-encoding route additionally includes raw conversation content in a Gemini request: ```js const routerPrompt = `You are a memory encoding router for an AI agent's persistent memory system. User said: "${(userMessage || '').slice(0, 1000)}" Agent said: "${(agentResponse || '').slice(0, 1500)}" ${topic ? `Topic: ${topic}` : ''} Recent memories already stored (DO NOT duplicate these): ${recentList || '(none)'}`; const routerRes = await fetch(geminiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ contents: [{ parts: [{ text: routerPrompt }] }], generationConfig: { temperature: 0, maxOutputTokens: 600, responseMimeType: 'application/json' }, }), }); ``` ### Technical Analysis The gateway searc ...[truncated 1943 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
execution-awareness.js:223
Finding

Hard-Coded Operational Directives Are Written into Persistent Agent Memory

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
gateway.js:690
Finding

Gateway Is Unauthenticated by Default and the Process Listens on All Network Interfaces

Content
View full analysis
{ // Health check is always public (for Docker healthcheck + monitoring) if (req.path === '/health') return next(); const auth = req.headers.authorization; if (auth === `Bearer ${API_KEY}`) return next(); res.status(401).json({ ok: false, error: 'Unauthorized' }); }); console.log('🔐 API key authentication enabled'); } ``` Sensitive routes are registered even when the optional key is absent: ```js app.post('/memory/encode', async (req, res) => { try { const result = await encode(req.body); res.json({ ok: true, ...result }); } catch (e) { res.status(400).json({ ok: false, error: e.message }); } }); app.post('/memory/recall', async (req, res) => { try { const { query, executionAware, ...rest } = req.body; const results = await recall({ query, executionAware, ...rest }); res.json({ ok: true, count: results.length, results }); } catch (e) { res.status(400).json({ ok: false, error: e.message }); } }); ``` The process listens on every interface: ```js const PORT = process.env.PORT || 3333; app.listen(PORT, '0.0.0.0', () => { console.log(`🧠 BrainDB Gateway v0.5.0 listening on port ${PORT}`); console.log(` Architecture: ${ARCHITECTURE}`); console.log(` Shards: ${Object.keys(SHARDS).join(', ')}`); console.log(` Auth: ${API_KEY ? 'API key required' : 'open (localhost only)'}`); }); ``` ### Technical Analysis Authentication middleware is installed only when `BRAINDB_API_KEY` is non-empty. The default Docker Compose value is empty, so the default state is unauthenticated. Although `docker-compose.yml` maps the host port to `127.0.0.1`, the Node process itself b ...[truncated 1381 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
install.sh:123
Finding

Shell-Controlled Values Are Interpolated into Dynamically Executed JavaScript

Content
View full analysis
/dev/null || echo "") ``` The installer later interpolates the same path and a port value into executable JavaScript: ```sh node -e " const fs = require('fs'); const config = JSON.parse(fs.readFileSync('$OPENCLAW_CONFIG', 'utf8')); if (!config.plugins) config.plugins = {}; if (!config.plugins.slots) config.plugins.slots = {}; config.plugins.slots.memory = 'braindb'; if (!config.plugins.entries) config.plugins.entries = {}; config.plugins.entries.braindb = { enabled: true, config: { gatewayUrl: 'http://localhost:$BRAINDB_PORT', autoCapture: true, autoRecall: true, maxRecallResults: 7, minMessageLength: 20 } }; fs.writeFileSync('$OPENCLAW_CONFIG', JSON.stringify(config, null, 2)); " ``` The uninstaller uses the same pattern: ```sh node -e " const fs = require('fs'); const config = JSON.parse(fs.readFileSync('$OPENCLAW_CONFIG', 'utf8')); if (config.plugins?.slots?.memory === 'braindb') { delete config.plugins.slots.memory; } if (config.plugins?.entries?.braindb) { delete config.plugins.entries.braindb; } fs.writeFileSync('$OPENCLAW_CONFIG', JSON.stringify(config, null, 2)); " ``` ### Technical Analysis `OPENCLAW_CONFIG` is environment-controlled, and `BRAINDB_PORT` can be influenced by arguments or the environment. These values are inserted directly into source code passed to `node -e`. A value containing a quote followed by JavaScript syntax can terminate the intended string and introduce arbitrary JavaScript. Shell quoting does not make the interpolated value safe inside the ...[truncated 830 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
setup.sh:32
Finding

Setup Executes the Contents of an Existing .env File as Shell Code

Content
View full analysis
.env echo "📋 Created .env with auto-generated Neo4j password" fi # Source .env for port variables set -a; source .env 2>/dev/null || true; set +a ``` ### Technical Analysis An environment file is expected to contain passive key/value configuration, but `source .env` instructs Bash to parse it as executable shell code. Command substitutions, function definitions, redirections, and arbitrary shell statements in an existing `.env` therefore run immediately. Suppressing errors and continuing with `|| true` does not limit execution. It may instead conceal indicators that the file contained unexpected syntax. ### Attack Path 1. An attacker modifies or plants `.env` in the project directory. 2. The file contains a payload such as a command substitution or standalone shell command. 3. The user runs `setup.sh`. 4. Bash sources `.env` and executes the payload with the user's privileges. 5. Setup continues, potentially hiding the compromise among normal Docker operations. ### Impact Assessment The payload gains all filesystem, process, credential, Docker, and network privileges available to the invoking user. Membership in the Docker group can effectively provide host-level control, making exploitation especially consequential. ]]>
Remediation
View remediation

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:23
Finding

Downloaded Skill Archive Is Executed Without Integrity or Signature Verification

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
package.json:6
Finding

Third-Party Runtime Components Are Not Pinned to Immutable Versions

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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (57)

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · README.md (reported line 62)May include surrounding context.

Health Check

bash
curl http://localhost:3333/health

Encode a Memory

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Undisclosed LLM/Gemini-powered query expansion, synthesis, auto-encoding, execution-awareness capture, and admin endpoints materially change the risk profile of the skill. These capabilities can expose user content to third parties, capture operational telemetry beyond expected memory features, and create powerful control surfaces that may be abused if not clearly documented and access-restricted.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Undisclosed LLM/Gemini-powered query expansion, synthesis, auto-encoding, execution-awareness capture, and admin endpoints materially change the risk profile of the skill. These capabilities can expose user content to third parties, capture operational telemetry beyond expected memory features, and create powerful control surfaces that may be abused if not clearly documented and access-restricted.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Undisclosed LLM/Gemini-powered query expansion, synthesis, auto-encoding, execution-awareness capture, and admin endpoints materially change the risk profile of the skill. These capabilities can expose user content to third parties, capture operational telemetry beyond expected memory features, and create powerful control surfaces that may be abused if not clearly documented and access-restricted.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Undisclosed LLM/Gemini-powered query expansion, synthesis, auto-encoding, execution-awareness capture, and admin endpoints materially change the risk profile of the skill. These capabilities can expose user content to third parties, capture operational telemetry beyond expected memory features, and create powerful control surfaces that may be abused if not clearly documented and access-restricted.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script performs broad host introspection far beyond a narrowly scoped 'persistent semantic memory' function: it enumerates installed CLI tools, user and workspace scripts, installed skills, and fleet metadata. This creates an unnecessary inventory of the local environment that can expose sensitive operational details and expands the blast radius if the BrainDB endpoint is compromised or misconfigured.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script reads arbitrary files from ~/bin and the workspace scripts directory, extracting content and paths to encode into memory. This can disclose private script names, internal tooling, filesystem layout, and embedded comments that may contain operational secrets or sensitive business context, none of which is necessary for core memory persistence.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

Harvesting installed skill metadata and fleet node information creates an internal capability map of the environment, including available skills and remote infrastructure. Such inventory data is highly useful for follow-on abuse because it reveals what systems exist, where they are located, and which mechanisms can be used to act on them.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The Gemini routing stage sends user queries together with candidate memory snippets to an external provider without visible disclosure. Because candidate snippets come from long-term memory, this can leak previously stored sensitive facts, preferences, relationships, or business information during normal recall operations.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The prompt explicitly instructs Gemini to predict follow-up questions about a person's preferences, relationships, business specifics, and personal details from recent queries. This is deliberate sensitive-data inference and profiling, which is especially dangerous in a persistent memory system because the outputs can drive further caching, retrieval, and exposure of private information.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The auto-encode endpoint sends raw user and agent conversation content to Gemini for long-term memory distillation. Because the prompt explicitly asks for user-specific personal, business, relationship, and preference details, sensitive data can be disclosed to a third party and then persisted indefinitely, compounding privacy and compliance risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This code transmits user and agent messages to external Gemini APIs for memory extraction, but there is no visible notice, consent flow, or user-facing disclosure in this file. In a memory product handling long-term personal data, undisclosed third-party processing materially increases privacy, legal, and trust risk.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The auto-encoding prompt instructs the model to retain long-term personal and business details such as family, schedule, clients, pricing, and pet peeves. This is a direct mechanism for building a persistent dossier of sensitive user information, with both external transmission and durable local storage, making the memory-skill context significantly more dangerous.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The session-context endpoint persists recent user messages, active tasks, pending questions, decisions, and summaries into memory. In a long-term memory system, this creates a high risk of storing raw conversational and behavioral data that may contain secrets, personal information, or sensitive operational details beyond what is necessary for compaction-proof context.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · install.sh (reported line 185)May include surrounding context.

sh
echo "📚 Step 4: Memory migration"
echo ""

MEMORY_COUNT=$(curl -sf "http://localhost:$BRAINDB_PORT/health" 2>/dev/null | node -e "
  let d=''; process.stdin.on('data',c=>d+=c); process.stdin.on('end',()=>{
    try { console.log(JSON.parse(d).totalMemories||0); } catch { console.log(0); }
  });

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · install.sh (reported line 224)May include surrounding context.

sh
echo "✅ BrainDB installed!"
echo ""
echo "   Gateway:  http://localhost:$BRAINDB_PORT"
echo "   Memories:  $(curl -sf http://localhost:$BRAINDB_PORT/health 2>/dev/null | node -e "let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{console.log(JSON.parse(d).totalMemories||0)}catch{console.log('?')}})" 2>/dev/null || echo "?")"
echo "   Backup:   $BACKUP_DIR"
echo ""
echo "   Restart OpenClaw to activate: openclaw gateway restart"

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The optional Swarm mode sends workspace-derived content to another service for extraction, creating a clear external data-transfer path for potentially sensitive local documents. In this skill context, that is especially risky because the source material includes personal memory files and operational notes, and the manifest does not make third-party processing a primary expected behavior.

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 · install.sh (reported line 93)May include surrounding context.

sh
exit 1
fi

# Create .env with secure random password if missing
if [ ! -f .env ]; then
  RANDOM_PASS=$(openssl rand -base64 18 | tr -d '/+=' | head -c 24)
  sed "s/CHANGE_ME/$RANDOM_PASS/" .env.example > .env

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 · install.sh (reported line 94)May include surrounding context.

sh
exit 1
fi

# Create .env with secure random password if missing
if [ ! -f .env ]; then
  RANDOM_PASS=$(openssl rand -base64 18 | tr -d '/+=' | head -c 24)
  sed "s/CHANGE_ME/$RANDOM_PASS/" .env.example > .env

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 · install.sh (reported line 96)May include surrounding context.

sh
exit 1
fi

# Create .env with secure random password if missing
if [ ! -f .env ]; then
  RANDOM_PASS=$(openssl rand -base64 18 | tr -d '/+=' | head -c 24)
  sed "s/CHANGE_ME/$RANDOM_PASS/" .env.example > .env

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 · setup.sh (reported line 32)May include surrounding context.

sh
exit 1
fi

# Create .env with secure random password if missing
if [ ! -f .env ]; then
  RANDOM_PASS=$(openssl rand -base64 18 | tr -d '/+=' | head -c 24)
  sed "s/CHANGE_ME/$RANDOM_PASS/" .env.example > .env

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 · setup.sh (reported line 33)May include surrounding context.

sh
exit 1
fi

# Create .env with secure random password if missing
if [ ! -f .env ]; then
  RANDOM_PASS=$(openssl rand -base64 18 | tr -d '/+=' | head -c 24)
  sed "s/CHANGE_ME/$RANDOM_PASS/" .env.example > .env

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 · setup.sh (reported line 35)May include surrounding context.

sh
exit 1
fi

# Create .env with secure random password if missing
if [ ! -f .env ]; then
  RANDOM_PASS=$(openssl rand -base64 18 | tr -d '/+=' | head -c 24)
  sed "s/CHANGE_ME/$RANDOM_PASS/" .env.example > .env

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 · setup.sh (reported line 36)May include surrounding context.

sh
exit 1
fi

# Create .env with secure random password if missing
if [ ! -f .env ]; then
  RANDOM_PASS=$(openssl rand -base64 18 | tr -d '/+=' | head -c 24)
  sed "s/CHANGE_ME/$RANDOM_PASS/" .env.example > .env

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 · setup.sh (reported line 40)May include surrounding context.

sh
exit 1
fi

# Create .env with secure random password if missing
if [ ! -f .env ]; then
  RANDOM_PASS=$(openssl rand -base64 18 | tr -d '/+=' | head -c 24)
  sed "s/CHANGE_ME/$RANDOM_PASS/" .env.example > .env

Static analysis

Detected: suspicious.dangerous_exec, suspicious.env_credential_access

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
execution-awareness.js:56

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
execution-awareness.js:27

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
gateway.js:8