Back to skill

Security audit

Guitar Chord

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a guitar-chord utility, but its diagram feature can run an unaudited local Cargo project from the user's home directory without clear disclosure.

Review before installing. Use the non-diagram chord and scale features only if the reliability limitations are acceptable. Avoid --diagram unless you fully trust the local ~/workspace/ascii_chord Cargo project, because this skill may build and run code from that directory. Expect some Chinese-language output and incomplete or broken advertised features such as capo calculation and reverse lookup.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
scripts/chord_identifier.py:267
Finding
Execution of an Unverified External Cargo Project## Vulnerability Details **File Location**: `scripts/chord_identifier.py:267-288` **Vulnerability Type**: Untrusted external dependency execution **Risk Level**: Medium ### Complete Code Snippet ```python def get_ascii_chord(chord_name): """调用 ascii_chord 获取和弦图""" import os # 转换和弦名格式 chord_name = chord_name.replace('bb', '#') try: home = os.path.expanduser('~') cwd = os.path.join(home, 'workspace', 'ascii_chord') result = subprocess.run( ['cargo', 'run', '--', 'get', chord_name], cwd=cwd, capture_output=True, text=True, timeout=10 ) if result.returncode == 0: return result.stdout else: return None except Exception as e: return None ``` ### Technical Analysis When diagram rendering is requested, the Skill executes `cargo run` inside `~/workspace/ascii_chord`. This project is outside the audited Skill package and is not pinned, authenticated, or checked for integrity before execution. Running a Cargo project may execute its compiled binary, build scripts such as `build.rs`, procedural macros, and code from resolved dependencies. Consequently, possession or modification of the expected directory provides a code-execution path. The subprocess uses an argument list rather than `shell=True`, so the user-provided chord name does not directly create a shell-command injection vulnerability. The issue is instead the unconditional trust placed in a mutable, unaudited external project and its dependency graph. The ten-second timeout limits waiting time but does not prevent code execution or reverse actions already performed. ### Attack Path 1. An attacker creates or modifies `~/workspace/ascii_chord`, its Cargo configuration, source files, build script, or resolved dependencies. 2. The user or Agent invokes a diagram-related operation, such as a chord lookup with `--diagram` or an inversion with dia ...[truncated 940 chars]
Remediation
## Remediation Suggestions 1. Remove the runtime dependency on a mutable project under the user's home directory. Implement diagram generation directly in the audited package where feasible. 2. If the Rust component is required, include its reviewed source in the Skill package and invoke a fixed, packaged artifact rather than using `cargo run`. 3. Pin all Rust dependencies with a committed `Cargo.lock`, review build scripts and procedural macros, and verify the packaged component using a trusted cryptographic digest. 4. Resolve and validate the component's canonical path before execution. Reject symbolic links and paths outside an explicitly approved installation directory. 5. Build the component during a trusted installation phase and run only the verified binary at runtime; do not permit runtime dependency resolution or compilation. 6. Execute the helper with a minimal environment and least privileges, restrict filesystem and network access through sandboxing, and retain the existing argument-array invocation. 7. Require explicit user consent before invoking an external executable and report failures clearly rather than silently suppressing every exception.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The finding indicates the documented behavior does not match the actual behavior, including an undeclared external subprocess invocation via `cargo run` in a user-home workspace path. Undeclared subprocess execution is dangerous because it can execute unreviewed local code, bypass expected supply-chain controls, and produce side effects outside the skill's stated purpose; the missing capo implementation also signals poor integrity between documentation and code, reducing trust and auditability.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill exposes shell execution examples and static analysis detected shell capabilities, but the manifest does not declare any tool scope such as permissions or allowed-tools. That creates an undeclared execution boundary, making it harder for a host to sandbox or review what the skill is allowed to invoke, and increases the risk of unexpected command execution if the implementation expands or accepts unsafe input.

Context-Inappropriate Capability

Medium
Confidence
92% confidence
Finding
The manifest describes a guitar chord toolkit with identification, diagrams, inversions, scales, and capo calculation, but this implementation shells out to `cargo run` in a user-home workspace to fulfill diagram lookup. Spawning a development-tool subprocess and depending on an external local project is not an obvious or necessary capability for the stated purpose, especially when the file also contains its own ASCII diagram generation logic elsewhere.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
try:
        home = os.path.expanduser('~')
        cwd = os.path.join(home, 'workspace', 'ascii_chord')
        result = subprocess.run(
            ['cargo', 'run', '--', 'get', chord_name],
            cwd=cwd,
            capture_output=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
The file is primarily written in English, but line L071 switches to Chinese for a core explanatory sentence. This can create a language/locale policy issue because the skill does not indicate that bilingual output is intentional, optional, or limited to a specific audience.

Natural-Language Policy Violations

Low
Confidence
94% confidence
Finding
The module description and many user-facing strings indicate the tool is designed to respond in Chinese, but there is no natural-language opt-in or alternative locale offered. This can violate language/locale policy when a skill implicitly forces a specific language for all users.

Missing User Warnings

Low
Confidence
83% confidence
Finding
The function invokes an external command via subprocess to run a local Cargo project, which is a safety-relevant operation for code files. Although this behavior is part of diagram generation, the file does not include a clear user-facing warning, prompt, or explanatory comment about executing an external tool from the user's home workspace.

Intent-Code Divergence

Low
Confidence
95% confidence
Finding
The docstring and surrounding logic present this function as computing Drop2 voicings generically for supported seventh chords, but the emitted analysis hardcodes `大七度(7)` and `大三度(3)`. For chords like dominant 7 or minor 7, those labels contradict the actual intervals being used, so the user-facing intent/documentation diverges from the behavior.

Static analysis

No suspicious patterns detected.