Back to skill

Security audit

Monorepo Analyzer

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent monorepo analyzer, but its documented stats command can execute unintended local commands when run on a repository with specially crafted paths.

Review before installing if you may analyze untrusted repositories. The core behavior is ordinary repository analysis, but avoid or fix the stats command unless paths are passed as arguments and iterated safely; use it only in trusted worktrees or low-privilege environments.

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:337
Finding

Arbitrary Python Code Execution Through Repository-Controlled Paths

Content
View full analysis
/dev/null); do DIR=$(dirname "$pj") NAME=$(python3 -c "import json; print(json.load(open('$pj')).get('name','$DIR'))" 2>/dev/null) LOC=$(find "$DIR" -type f \( -name "*.ts" -o -name "*.js" -o -name "*.tsx" -o -name "*.jsx" \) \ -not -path '*/node_modules/*' -not -path '*/dist/*' 2>/dev/null | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}') echo " $NAME: ${LOC:-0} lines" done # Git activity per package (last 30 days) echo "=== Recent Activity (30 days) ===" for pj in $(find . -maxdepth 3 -name "package.json" -not -path '*/node_modules/*' 2>/dev/null); do DIR=$(dirname "$pj") NAME=$(python3 -c "import json; print(json.load(open('$pj')).get('name','$DIR'))" 2>/dev/null) ``` ### Technical Analysis The `stats` command obtains `$pj` and `$DIR` from repository-controlled file and directory names. It then interpolates these values directly into source code passed to `python3 -c`: ```bash open('$pj') .get('name','$DIR') ``` Shell double quoting does not make this safe because the generated Python program still treats embedded single quotes and Python syntax as code. A malicious directory name can terminate or alter the Python string expression and cause attacker-selected Python expressions to execute. For example, a directory name containing an expression conceptually similar to: ```text x'+str(__import__('os').system('ATTACKER_COMMAND'))+'x ``` would be incorporated into the argument to `open(...)`. Python evaluates the injected `os.system(...)` expression before attempting to open the resulting path. The use of: ```bash for pj in $(find ...) ``` also performs shell word splitting and glob expansion. Consequently, ordinary repository ...[truncated 1896 chars]
Remediation
View remediation
/dev/null ) ``` Replace command-substitution iteration with null-delimited filename processing so all valid filenames are handled as data: ```bash find . -maxdepth 3 -name 'package.json' \ -not -path '*/node_modules/*' -print0 2>/dev/null | while IFS= read -r -d '' pj; do DIR=$(dirname -- "$pj") # Process "$pj" and "$DIR" exclusively as quoted arguments. done ``` Additional hardening should include: 1. Use `--` where supported before path operands to prevent option injection. 2. Use null-delimited pipelines, such as `find -print0` with `xargs -0`, for source-file counting. 3. Keep every expansion of `$pj` and `$DIR` quoted. 4. Avoid dynamically constructing source code, shell commands, or expressions from filenames. 5. Test the command against paths containing quotes, whitespace, newlines, wildcard characters, leading hyphens, and non-ASCII characters. 6. Run repository-analysis skills with least privilege and without unnecessary credentials when processing untrusted repositories. ]]>
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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 (2)

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Line L126 says Cargo/Go workspaces are parsed similarly for dependency analysis, and L382 broadly claims support for Rust and Go monorepos. In code, deps, circular, versions, unused, build-order, and stats operate on **/package.json only, while Cargo and Go receive only shallow discovery via Cargo.toml/go.work inspection.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest and introductory description focus on monorepo structure analysis: workspace detection, dependency mapping, unused packages, version inconsistencies, build order, and circular dependencies. The stats command additionally measures lines of code and queries git commit activity, which are repository metrics not described in the manifest's stated capability set.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.