Back to skill

Security audit

Angus Bounty Hunter

Security checks for vulnerabilities and agentic risk

Overview

This skill is a legitimate smart-contract scanning helper, but its default scan path can run code from untrusted repositories on the user's machine.

Install only if you will run scans inside a disposable container or VM with no sensitive host credentials, wallet files, SSH agents, or cloud tokens available. Avoid scanning arbitrary repositories directly on your host, and review or disable the npm/pip install steps before use.

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

T08 · Insecure Dependencies

Error
Location
scripts/scan.sh:39
Finding
Automatic Execution of Dependencies from Untrusted Target Repositories<![CDATA[ ## Vulnerability Details **File Location**: `scripts/scan.sh:39-40` **Vulnerability Type**: Unsafe dependency installation from an untrusted repository **Risk Level**: High ### Vulnerable Code ```bash # Install deps [ -f "package.json" ] && npm install --silent 2>/dev/null || true [ -f "requirements.txt" ] && pip3 install -r requirements.txt --quiet 2>/dev/null || true ``` ### Technical Analysis The script accepts an arbitrary repository URL, clones that repository, and then automatically runs its dependency installation procedures. The cloned repository must therefore be treated as attacker-controlled input. Running `npm install` can execute package lifecycle scripts such as `preinstall`, `install`, and `postinstall`. These scripts can contain arbitrary commands. Similarly, installing Python dependencies can execute attacker-controlled build backends, source-distribution build logic, or legacy setup code. The dependencies are not validated against an allowlist, isolated from the host, or required to use cryptographic hashes. The installation commands run with the full permissions of the user who invoked the Skill. Suppressing errors and continuing with `|| true` also reduces visibility into malicious or unexpected installation behavior. Dependency installation may sometimes be necessary to compile a target, but automatically performing it on the host exceeds the minimum privileges required for static source analysis. ### Attack Path 1. An attacker creates or compromises a smart-contract repository. 2. The repository contains one of the following: - A malicious npm lifecycle script in `package.json`. - A dependency that executes malicious npm lifecycle code. - A malicious Python source package or build backend referenced by `requirements.txt`. 3. The attacker persuades a user to scan the repository or submits it as a purported bounty target. 4. The user runs: ```bash bash scripts/scan.sh <attacker-controlled-repository-url> ...[truncated 901 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Do not install dependencies from scanned repositories directly on the host. - Perform compilation and analysis in a disposable, unprivileged container or virtual machine. - Disable network access during dependency installation and scanning unless explicitly required. - Do not mount SSH agents, cloud credentials, wallet files, Docker sockets, or sensitive host directories into the sandbox. - Apply read-only filesystems, CPU and memory limits, process limits, and a dedicated non-root user. - Require explicit user confirmation before any dependency installation. - For npm projects, prefer a reviewed lockfile and use `npm ci --ignore-scripts` where compatible. - For Python projects, use a disposable virtual environment, require hash-pinned dependencies, and avoid unreviewed source distributions or build backends. - Display installation failures instead of suppressing all diagnostics. - Consider making dependency installation an opt-in mode separate from the default static scan. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/triage.sh:12
Finding
Python Code Injection Through an Attacker-Controlled Findings Filename<![CDATA[ ## Vulnerability Details **File Location**: `scripts/triage.sh:12-16` and `scripts/triage.sh:47-50` **Vulnerability Type**: Python source-code injection through unsafe shell interpolation **Risk Level**: High ### Vulnerable Code The first Python invocation directly inserts the supplied filename into Python source: ```bash # Extract HIGH/MEDIUM findings python3 << PYEOF import json, sys with open("$JSON_FILE") as f: data = json.load(f) ``` The same unsafe pattern is repeated in the optional Ollama triage path: ```bash FINDINGS_TEXT=$(python3 -c " import json with open('$JSON_FILE') as f: data = json.load(f) findings = [d for d in data.get('results',{}).get('detectors',[]) if d.get('impact') in ('High','Medium')] for f in findings[:5]: print(f'{f.get(\"check\")}: {f.get(\"description\",\"\")[:150]}') ") ``` ### Technical Analysis `JSON_FILE` originates from the script's first command-line argument. Although the script verifies that the path exists, it does not ensure that the path is safe to embed in Python source code. In the first invocation, an unquoted heredoc allows the shell to expand `$JSON_FILE` into a double-quoted Python string literal. In the second invocation, the path is inserted into a single-quoted Python string inside the `python3 -c` program. A filename can contain quote characters, semicolons, parentheses, and newline characters. A crafted existing filename can therefore terminate the intended string literal and introduce additional Python statements. Shell quoting around the variable would not be sufficient because the vulnerability occurs when constructing Python source, not merely when passing a shell argument. The path must be passed as data through `sys.argv` or an environment variable. ### Attack Path 1. An attacker provides a valid Slither JSON file with a specially crafted filename containing Python syntax. 2. The crafted file is placed in a location accessible to the victim. The filename itself contains ...[truncated 1462 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Pass the filename as a positional argument rather than inserting it into generated Python source. Quote the heredoc delimiter to prevent shell expansion: ```bash python3 - "$JSON_FILE" <<'PYEOF' import json import sys with open(sys.argv[1]) as f: data = json.load(f) detectors = data.get("results", {}).get("detectors", []) findings = [ finding for finding in detectors if finding.get("impact") in ("High", "Medium") ] PYEOF ``` Apply the same approach to the second Python invocation: ```bash FINDINGS_TEXT=$( python3 - "$JSON_FILE" <<'PYEOF' import json import sys with open(sys.argv[1]) as f: data = json.load(f) findings = [ finding for finding in data.get("results", {}).get("detectors", []) if finding.get("impact") in ("High", "Medium") ] for finding in findings[:5]: print( f"{finding.get('check')}: " f"{finding.get('description', '')[:150]}" ) PYEOF ) ``` Additional hardening should include: - Using `set -euo pipefail`. - Rejecting unexpected file types and validating that the input is regular JSON data. - Avoiding dynamic construction of source code from all user-controlled values. - Adding tests with paths containing quotes, whitespace, newlines, and shell metacharacters. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The declared description frames the skill as a bounded bug-bounty scanner, but the documented behavior is broader: it accepts arbitrary GitHub repo URLs and performs clone/install/scan actions. This mismatch is risky because users or orchestration systems may trust the narrower description while the skill actually enables more powerful code-fetching and environment-modifying behavior than advertised.

External Script Fetching

High
Category
Supply Chain
Content
PYEOF

# If Ollama is available, ask it to rate exploitability
if curl -s http://127.0.0.1:11434/api/tags >/dev/null 2>&1; then
  echo "--- Local LLM Triage ---"
  FINDINGS_TEXT=$(python3 -c "
import json
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill advertises shell-driven workflows (`bash scripts/scan.sh`, `triage.sh`, `poc-template.sh`) but declares no `permissions` or `allowed-tools` scope. That leaves execution boundaries undefined, which is dangerous because the workflow includes cloning arbitrary repositories and likely running package/compiler setup, increasing the chance of unintended command execution or over-broad agent capabilities.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
The script installs dependencies directly from an untrusted target repository via npm and pip during the scanning workflow. Package install hooks, malicious setup scripts, dependency confusion, or poisoned requirement entries can execute arbitrary code on the analyst's machine or CI runner, turning a passive scan into active execution of attacker-controlled content.

External Transmission

Medium
Category
Data Exfiltration
Content
PYEOF

# If Ollama is available, ask it to rate exploitability
if curl -s http://127.0.0.1:11434/api/tags >/dev/null 2>&1; then
  echo "--- Local LLM Triage ---"
  FINDINGS_TEXT=$(python3 -c "
import json
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Static analysis

No suspicious patterns detected.