Back to skill

Security audit

第二大脑箴言

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for second-brain writing, but it can implicitly read private notes and gives unsafe shell-style recall commands using user-controlled text.

Install only if you are comfortable with an implicitly invokable skill reading selected local second-brain files for writing tasks. Avoid using untrusted or shell-like text as recall topics unless the runtime executes gbrain/cm with shell-disabled argument arrays, and prefer explicit invocation when you want personal notes used.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:61
Finding

Command Injection Through Unsafely Interpolated Recall Topics

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 61-63
Vulnerability Type: OS command injection
Risk Level: High

Vulnerable Code

bash
gbrain search "<user's exact topic>" --limit 5
gbrain search "<selected anchor or close synonym>" --limit 5
cm context "<user's exact topic>" --json --limit 5 --history 5

Technical Analysis

The skill instructs the agent to insert user-controlled topics and selected anchor text directly into double-quoted shell command strings. Double quotes do not prevent shell evaluation of command substitutions such as $(...) or backticks. Inputs containing quote-breaking syntax may also alter the command structure.

Therefore, if the agent implements these instructions through a shell, text intended only as a search query can be interpreted as executable shell syntax. No validation, shell escaping, argument-array invocation, or explicit prohibition against shell evaluation is specified.

Attack Path

  1. An attacker requests an aphorism about a topic containing shell metacharacters or command substitution syntax.
  2. The skill directs the agent to use the attacker's exact topic in the documented recall commands.
  3. The agent substitutes the topic into one or both command templates.
  4. The agent executes the resulting command through a shell.
  5. The shell evaluates the injected syntax before or while invoking gbrain or cm.
  6. The injected command executes with the operating-system privileges and environment available to the agent.

Exploitation depends on the runtime following these command templates through a shell rather than using a shell-disabled argument API.

Impact Assessment

Successful exploitation can provide arbitrary command execution under the agent process's user account. The attacker could potentially read accessible second-brain notes and other local files, modify or delete user data, invoke installed programs, access ...[truncated 329 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not construct command-line strings by interpolating user-controlled text.
  2. Invoke gbrain and cm with a shell-disabled process API and an explicit argument array, for example conceptually:
    text
    ["gbrain", "search", userTopic, "--limit", "5"]
    ["cm", "context", userTopic, "--json", "--limit", "5", "--history", "5"]
    
  3. Explicitly instruct the agent never to use shell=true, sh -c, bash -c, or equivalent wrappers for recall queries.
  4. Treat anchor names and synonyms derived from user-controlled notes as untrusted input as well.
  5. If only a shell interface is available, apply platform-specific escaping with a well-tested library and reject control characters, command substitutions, redirection operators, separators, and unexpected newlines. Validation alone should not replace shell-disabled execution.
  6. Add adversarial tests covering inputs containing $(), backticks, quotes, semicolons, pipes, redirections, newlines, and shell-specific expansion syntax.
  7. Run recall tools with least privilege, restricted filesystem access, a minimal environment, and network access disabled unless explicitly required.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
Findings (7)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger description is broad enough to match many generic writing requests such as quotes, short lines, or article endings, which can cause the skill to activate outside its intended second-brain context. This is dangerous because it may inappropriately steer unrelated user requests into local-note recall flows, increasing the chance of unintended data exposure from personal knowledge sources or misrouting user intent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill enables implicit invocation and describes broad usage around a user's notes, second brain, and personal knowledge without clear trigger boundaries. That can cause the agent to activate in ambiguous contexts and pull from sensitive personal memory or private note stores when the user did not explicitly intend that behavior, increasing the risk of over-collection, privacy leakage, or context misuse.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The summary and description repeatedly specify generating Chinese reflections and aphorisms, which reads as a fixed language requirement rather than a user-selectable preference. Under the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale constraint is clearly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file explicitly requires multiple output shapes to be written in Chinese characters and reinforces this in the voice guidance. Because this natural-language instruction forces a specific language regardless of user preference, it fits the policy category for language or locale restrictions without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The description explicitly states the skill will "Generate grounded Chinese reflections," which imposes a language constraint in natural language. Under the policy, forcing a specific language without user opt-in is a reportable locale/language violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The instruction 'Default to Chinese unless the user asks for another language' imposes a language preference by default. This is a locale/language policy concern because it selects a language without first offering the user a choice or confirming preference.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The visible interface metadata is in Chinese, but the default prompt is fixed in English and does not indicate any user opt-in or language selection behavior. This can amount to a language policy issue because the skill appears to impose a specific language for operation despite a different presented locale.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.