Back to skill

Security audit

Embedded Code Review Expert

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent firmware review helper, but its diff script can be abused to overwrite files through an unvalidated Git range argument.

Install only if you are comfortable sharing reviewed diffs with the configured ACP agents. Before using it on untrusted requests or repositories, fix or avoid the diff_range path in scripts/prepare-diff.sh by rejecting ranges beginning with '-' and validating revisions; otherwise a malicious range could overwrite files writable by the agent user. Running reviews in a limited sandbox is advisable for sensitive firmware code.

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
scripts/prepare-diff.sh:10
Finding

Git Option Injection Through the Unvalidated Diff Range Argument

Content
View full analysis

Vulnerability Details

File Location: scripts/prepare-diff.sh, lines 10-11 and 34-40
Vulnerability Type: Git argument and option injection
Risk Level: High

Vulnerable Code

bash
REPO="${1:-.}"
RANGE="${2:-}"

cd "$REPO"

# ...

if [ -n "$RANGE" ]; then
    git diff --stat "$RANGE" 2>/dev/null
    echo ""
    echo "=== DIFF ==="
    git diff "$RANGE" 2>/dev/null

Technical Analysis

The script treats its second argument as a Git revision range but passes it directly to git diff without validating its syntax or preventing it from being interpreted as a command-line option.

Shell quoting prevents shell metacharacter injection, but it does not prevent option injection into Git. For example, an argument beginning with -, such as --output=/attacker/chosen/path, is processed by Git as an option rather than as a revision range. The two git diff invocations can consequently create or overwrite the specified file using the permissions of the account running the Skill.

Other accepted Git options could alter diff processing. In environments containing attacker-controlled Git configuration or configured external diff helpers, options that enable external diff behavior may also expand the impact. This is not direct shell command injection by itself, but it exposes unsafe Git functionality through an input documented as a revision range.

Attack Path

  1. An attacker controls or influences the revision-range value supplied to the Skill, such as through a review request or copied command.

  2. The attacker supplies a value beginning with a Git option, for example:

    text
    --output=/path/writable/by/the-victim/target-file
    
  3. The Skill invokes scripts/prepare-diff.sh with that value as its second argument.

  4. The script passes the argument directly to both git diff commands.

  5. Git interprets the argument as an option and writes diff output to the selected path.

...[truncated 974 chars]

Remediation
View remediation

Remediation Suggestions

  1. Reject any range argument beginning with - before invoking Git:

    bash
    if [[ -n "$RANGE" && "$RANGE" == -* ]]; then
        echo "Error: diff range must not begin with '-'" >&2
        exit 2
    fi
    
  2. Validate that the input contains only supported revision syntax. Prefer a narrow policy, such as a single commit or a two-endpoint A..B or A...B range, rather than accepting arbitrary git diff syntax.

  3. Resolve each revision endpoint with git rev-parse --verify before passing it to git diff. On supported Git versions, use --end-of-options while resolving revisions:

    bash
    git rev-parse --verify --end-of-options "${REV}^{commit}"
    
  4. After validation, terminate revision processing with -- when invoking the diff so subsequent values cannot be interpreted as options or ambiguous path specifications:

    bash
    git diff --stat "$VALIDATED_RANGE" --
    git diff "$VALIDATED_RANGE" --
    
  5. Do not attempt to fix this solely through shell quoting; quoting addresses shell parsing but not Git's own option parser.

  6. Run reviews of untrusted repositories in a sandbox with limited filesystem access, no sensitive credentials, and external Git diff execution disabled.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code chunk is a preparation utility, not a reviewer. It changes into a repo, prints branch/commit info, greps build files for likely MCU/RTOS/compiler markers, and outputs git diff statistics and raw diffs. That supports a review workflow, but the declared description presents the skill itself as performing expert embedded/firmware review with specific defect detection and dual-model orchestration. None of those core capabilities are implemented in this code, so the actual behavior is materially narrower and different from the declared purpose.

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

md
- Load `references/interrupt-safety.md` for detailed checklist.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- Load `references/interrupt-safety.md` for detailed checklist.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- Load `references/interrupt-safety.md` for detailed checklist.

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

Scanner excerpt · references/c-pitfalls.md (reported line 56)May include surrounding context.

md
// 3. Integer promotion in expressions
uint8_t a = 200, b = 100;
uint8_t c = a + b;  // Promoted to int, result 300, truncated to 44
// No warning from most compilers!

// 4. Comparison of signed and unsigned
int x = -1;

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
85% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

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

As Claude Code Skill

bash
mkdir -p ~/.claude/skills
git clone https://github.com/ylongwang2782/embedded-review.git ~/.claude/skills/embedded-review

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

As Claude Code Skill

bash
mkdir -p ~/.claude/skills
git clone https://github.com/ylongwang2782/embedded-review.git ~/.claude/skills/embedded-review

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The example phrase "Review my current git changes in firmware-pro2" is presented as a natural-language invocation without any explicit trigger constraints, command prefix, or exclusion conditions. Because this is ordinary conversational wording rather than a narrowly scoped command, the skill documentation leaves activation boundaries unclear.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The phrase "用双模型 review firmware-pro2 feat/nfc 的改动" is shown as a valid invocation, but the README does not specify whether this exact phrasing is required, what variants are accepted, or when similar requests should not activate the skill. That ambiguity increases the chance of unintended invocation from everyday review-related requests.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
55% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/interrupt-safety.md (reported line 48)May include surrounding context.

md
uint32_t primask = __get_PRIMASK();
__disable_irq();
// ... critical section ...
__set_PRIMASK(primask);  // Restore previous state, don't blindly enable

// Method 2: BASEPRI (Cortex-M3+ only, allows higher-priority IRQs)
__set_BASEPRI(configMAX_SYSCALL_INTERRUPT_PRIORITY);

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
71% confidence
Finding

The documentation includes a Chinese-language invocation example for dual-model review, but it does not explicitly state whether users may choose their preferred language or whether the skill is language-agnostic. In the absence of that clarification, the example can be interpreted as a locale-specific expectation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.