Back to skill

Security audit

Knowledge Graph

Security checks for vulnerabilities and agentic risk

Overview

This skill is a useful local knowledge graph, but it persistently changes agent instructions to automatically collect broad personal, infrastructure, and credential-related information.

Install only if you are comfortable with your agent being instructed across future sessions to proactively store structured information about people, projects, infrastructure, preferences, places, habits, and credentials. Review or remove the injected KG-AUTONOMOUS block after install, avoid using the vault command with plaintext secrets in shell arguments, and do not run memory import unless you have reviewed the exact files and categories being scanned.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T01 · Skill Instruction Hijacking

Error
Location
scripts/install.mjs:156
Finding

Persistent Modification of Agent Control Instructions Enables Autonomous Sensitive-Data Collection

Content
View full analysis
'; const KG_MARKER_END = ''; if (existsSync(AGENT_FILE_PATH)) { let content = readFileSync(AGENT_FILE_PATH, 'utf8'); if (content.includes(KG_MARKER)) { const startIdx = content.indexOf(KG_MARKER); const endIdx = content.indexOf(KG_MARKER_END); if (endIdx !== -1) { content = content.slice(0, startIdx) + generateAgentsBlock() + content.slice(endIdx + KG_MARKER_END.length); writeFileSync(AGENT_FILE_PATH, content); console.log(`✅ Updated KG section in ${AGENT_FILENAME}`); } } else { content = content.trimEnd() + '\n\n' + generateAgentsBlock(); writeFileSync(AGENT_FILE_PATH, content); console.log(`✅ Added KG section to ${AGENT_FILENAME}`); } } else { writeFileSync(AGENT_FILE_PATH, generateAgentsBlock()); console.log(`✅ Created ${AGENT_FILENAME} with KG section`); } ``` The installed instruction block contains: ```javascript return `${KG_MARKER} ## Knowledge Graph (Autonomous) Structured knowledge store — **always available, use proactively without being asked.** ### Every Session Read \`${s}/data/kg-summary.md\` to see what's in the graph. ### When to ADD (do this automatically): - New **person, project, device, org, service, concept** mentioned - **Decision** made or **credential/API key** shared (use vault for secrets) - **Preferences/opinions** → entity + \`likes\`/\`dislikes\` relation - **People relationships** → \`human\` + \`knows\` relation - **Places, events, habits, milestones** → matching entity type ``` The Skill declaration reinforces the behavior: ```yaml description: "Embedded knowledge graph for persis ...[truncated 2630 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/import-memory.mjs:14
Finding

Workspace Memory Importer Scans and Duplicates Sensitive Personal and Infrastructure Data

Content
View full analysis
/skills/knowledge-graph/ or ~/.openclaw/skills/knowledge-graph/ // Memory lives at /memory/ and /MEMORY.md function findWorkspace() { // Try: skill is inside workspace/skills/ const wsCandidate = join(__dirname, '..', '..', '..'); if (existsSync(join(wsCandidate, 'MEMORY.md')) || existsSync(join(wsCandidate, 'memory'))) { return wsCandidate; } // Fallback: standard openclaw workspace const home = process.env.HOME || require('os').homedir(); return join(home, '.openclaw', 'workspace'); } const WORKSPACE = findWorkspace(); const MEMORY_DIR = join(WORKSPACE, 'memory'); const MEMORY_FILE = join(WORKSPACE, 'MEMORY.md'); ``` ```javascript function readMemory() { const files = []; if (existsSync(MEMORY_FILE)) { files.push({ path: MEMORY_FILE, content: readFileSync(MEMORY_FILE, 'utf8') }); } if (existsSync(MEMORY_DIR)) { const mdFiles = readdirSync(MEMORY_DIR) .filter(f => f.endsWith('.md')) .sort() .reverse() // recent first .slice(0, 30); // limit to last 30 files for (const f of mdFiles) { const p = join(MEMORY_DIR, f); files.push({ path: p, content: readFileSync(p, 'utf8') }); } } return files; } ``` ```javascript for (const c of candidates) { const sources = [...c.sources].map(s => s.split('/').pop()).join(', '); const attrsStr = Object.keys(c.attrs).length ? ` attrs:${JSON.stringify(c.attrs)}` : ''; console.log(` [${c.type}] ${c.label}`); console.log(` id: ${c.id} | pattern: ${c.patternName} | seen: ${c.count}x | in: ${sources}${attrsStr}`); if (c.tags.length) console.log(` tags: ${c.tags.join(', ')}`); } ``` ```javas ...[truncated 2619 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/vault.mjs:20
Finding

Secret Values Are Accepted Through Process Command-Line Arguments

Content
View full analysis
[--note "desc")] // node vault.mjs get // node vault.mjs list // node vault.mjs del ``` ```javascript if (cmd === 'set') { const key = args[1], value = args[2]; if (!key || !value) { console.error('Usage: vault.mjs set '); process.exit(1); } vaultSet(key, value, flag('note') || ''); console.log(`🔐 Stored: ${key}`); } ``` The documented example is: ```bash node scripts/vault.mjs set API_KEY sk-xxx --note "OpenAI key" ``` ### Technical Analysis The vault encrypts secrets at rest, but the CLI requires the plaintext value as a command-line argument. Command-line arguments can be exposed before encryption through: - Shell history - Process inspection tools - Operating-system process accounting - Agent tool-call records - Terminal session logging - Audit and monitoring software - Error reports that capture invoked commands Encryption of `vault.enc.json` does not mitigate disclosure at the input boundary. The issue is particularly significant because the persistent agent instructions explicitly encourage automatic storage of credentials and API keys. ### Attack Path 1. A user or agent executes the documented `vault.mjs set` command with a plaintext API key or password. 2. The shell records the command or the agent framework stores the tool invocation. 3. While the process is running, the plaintext value may be visible in the process argument list. 4. A local user, monitoring process, log reader, or later history inspection obtains the secret. 5. The attacker uses the recovered credential against its associated service. ### Impact Assessment The exposed privilege is determined by the stored cred ...[truncated 344 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
lib/vault.mjs:21
Finding

Existing Vault and Encryption-Key Files Are Used Without Permission Validation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (49)

External Script Fetching

High
Category
Supply Chain
Confidence
91% confidence
Finding

The README recommends piping remote content fetched with curl directly into a Node command, which normalizes unsafe shell patterns around untrusted external input. Even if the shown snippet is incomplete, this workflow encourages processing attacker-controlled network data without integrity verification, content validation, or safe handling boundaries, increasing the risk of command misuse, malicious content ingestion, or unsafe copy-paste adaptations by users and agents.

Content

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

bash
# 1. Save article text
curl -s https://example.com/article | node -e "..." > /tmp/article.txt

# 2. Get complexity score + bash template
node scripts/depth-check.mjs --file /tmp/article.txt

Vague Triggers

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The auto-trigger conditions are extremely broad, covering ordinary mentions of people, places, preferences, projects, routines, and knowledge artifacts, and instruct the skill to act proactively without waiting for user request. In practice this can cause constant invocation and silent persistence of user data in routine conversations, greatly increasing privacy and data-minimization risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill explicitly targets persistent storage of sensitive categories such as credentials, locations, life events, habits, preferences, and relationships, yet provides no upfront user warning or consent workflow in the skill description. Users may unknowingly disclose highly sensitive information that is then retained across sessions, creating privacy, compliance, and secondary-use risks.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The instruction to store credentials or API keys whenever they are mentioned creates an active sensitive-data capture pathway. Even though the file mentions a vault, automatic ingestion of secrets from conversation is highly dangerous because users may reveal credentials incidentally, without intent to persist them, leading to unauthorized retention and elevated blast radius if the vault or agent is compromised.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The instruction to store credentials or API keys whenever they are mentioned creates an active sensitive-data capture pathway. Even though the file mentions a vault, automatic ingestion of secrets from conversation is highly dangerous because users may reveal credentials incidentally, without intent to persist them, leading to unauthorized retention and elevated blast radius if the vault or agent is compromised.

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 34)May include surrounding context.

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/query.mjs children <id> # Direct children

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/vault.mjs set <key> <value> --note "description"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/vault.mjs set <key> <value> --note "description"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/vault.mjs set <key> <value> --note "description"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/vault.mjs set <key> <value> --note "description"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/depth-check.mjs "paste text or summary here"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/depth-check.mjs "paste text or summary here"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/depth-check.mjs "paste text or summary here"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/depth-check.mjs "paste text or summary here"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/import-memory.mjs # dry-run

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/import-memory.mjs # dry-run

Static analysis

No suspicious patterns detected.