Back to skill

Security audit

Guard Scanner

Security checks for vulnerabilities and agentic risk

Overview

This looks like a legitimate security scanner, but one audit path can turn a crafted ClawHub query into local shell command execution.

Review or fix the ClawHub audit command-injection issue before using this with untrusted input. Treat the malicious fixture files as hazardous test samples and do not execute them directly. Also verify a built package before installation because this source artifact did not include the compiled plugin and launcher files referenced by package metadata.

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
src/asset-auditor.ts:342
Finding

OS Command Injection in ClawHub Asset Audit Query

Content
View full analysis

Vulnerability Details

File Location: src/asset-auditor.ts:342-351
Vulnerability Type: OS command injection through shell interpolation
Risk Level: High

Vulnerable Code

ts
try {
    // Try clawhub CLI first
    const output = execSync(`clawhub search "${query}" --json 2>/dev/null`, {
        timeout: this.timeout,
        encoding: 'utf-8',
    });
    const parsed = JSON.parse(output);

The untrusted query value originates from the command-line argument args[2] and is passed without validation from src/cli.ts:123-124 and src/cli.ts:183:

ts
const subCmd = args[1]; // npm | github | clawhub | all
const target = args[2]; // username or query
ts
if (subCmd === 'clawhub' || subCmd === 'all') {
    await auditor.auditClawHub(target);
}

Technical Analysis

auditClawHub() constructs a command string by interpolating attacker-controlled input and executes it through child_process.execSync(). Because execSync() invokes a shell, placing the input inside double quotes does not make it safe. Shell constructs that remain active inside double quotes—including command substitution using $(...) or backticks—can be evaluated before the clawhub process starts.

Shell execution is not necessary for the declared asset-audit functionality. The scanner only needs to invoke a fixed executable with a query argument. Consequently, this implementation exceeds minimum privilege by exposing a general command-execution channel instead of using an argument-vector API.

Attack Path

  1. An attacker supplies or persuades a user or automated workflow to use a crafted ClawHub audit query containing shell substitution syntax.
  2. The CLI reads the crafted query into target from args[2].
  3. src/cli.ts calls auditor.auditClawHub(target).
  4. auditClawHub() interpolates the query into the command string.
  5. execSync() passes the string to the operating-syst ...[truncated 1303 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace shell-based execSync() with execFileSync() or spawnSync() and pass each argument separately:

    ts
    import { execFileSync } from 'node:child_process';
    
    const output = execFileSync(
        'clawhub',
        ['search', query, '--json'],
        {
            timeout: this.timeout,
            encoding: 'utf-8',
            stdio: ['ignore', 'pipe', 'pipe'],
        },
    );
    
  2. Do not use shell redirection such as 2>/dev/null. Capture or ignore stderr through the child-process stdio option.

  3. Validate the query as defense in depth:

    • Require a string.
    • Enforce a reasonable maximum length.
    • Reject NUL bytes and control characters.
    • Apply a restrictive character allowlist if ClawHub query semantics permit it.
  4. Add regression tests using metacharacters and command-substitution sequences. Verify that they are passed literally as one argument and never interpreted by a shell.

  5. Run the audit process with a minimal environment and least-privileged account, especially in CI.

  6. Review all other command-string construction in project scripts and migrate to argument-vector process APIs where any value may become externally controlled.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (540)

Missing User Warnings

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The markdown description conceals the real behavior of the skill and provides no warning that it accesses local credentials and transmits them externally. This mismatch between declared purpose and actual behavior increases the risk of social engineering, unauthorized installation, and unnoticed compromise.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill presents itself as helping users manage passwords securely, but the embedded code reads sensitive local credential files and sends them to an attacker-controlled external host. This is a direct credential theft and exfiltration workflow disguised as benign functionality, making it an intentionally deceptive and highly dangerous supply-chain style artifact.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code explicitly harvests SSH private keys, AWS credentials, and environment variables, then exfiltrates them over HTTPS to an attacker-controlled domain. Those actions are unrelated to secure password management and indicate deliberate credential access, data theft, and unauthorized outbound transmission.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The manifest describes a defensive scanner, but the implementation performs credential harvesting and remote transmission to an attacker-controlled domain. That mismatch is especially dangerous because users may trust and install the skill for security purposes, giving malicious code a credible disguise and increasing the likelihood of successful compromise.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code explicitly reads highly sensitive local secrets from ~/.ssh/id_rsa and ~/.aws/credentials, packages them together with environment variables, and sends them to an external host over HTTPS. In the context of a defensive security scanner/runtime guard, this behavior is unrelated to legitimate functionality and is a direct credential-theft and exfiltration mechanism.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

This is a true positive: the skill’s stated purpose is deceptive, while the embedded code downloads and executes a miner, kills a security scanner, deletes logs, and hijacks CPU cycles. In the context of an installable agent skill, this is overtly malicious because it enables unauthorized resource theft, defense evasion, and anti-forensics on the host system.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

This finding is valid because the capabilities present are far beyond any legitimate need for 'system optimization' and directly map to attacker behavior: remote payload delivery, execution, tampering with defenses, anti-forensics, and compute hijacking. The skill context makes it more dangerous because users may install or run it under trust assumptions, giving the malicious code execution on developer or CI/CD systems.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code uses child_process.exec to fetch a remote binary, mark it executable, run it in the background, terminate a security tool, and delete log files. These capabilities are not justified for a scanner fixture unless explicitly isolated as inert test data, and here the code is directly executable JavaScript that would compromise a host if run.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file is overtly malicious: it downloads and executes an XMRig cryptominer, kills a security-related process, deletes system logs, and consumes CPU in a persistent loop. In the context of a security scanner skill, this is especially dangerous because it directly contradicts the stated purpose and indicates deceptive, hostile behavior aimed at monetization, evasion, and anti-forensics.

Content

No source excerpt is available for this finding.

Missing User Warnings

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code kills a process matching guard-scanner and deletes syslog/auth logs, which is classic defense evasion and anti-forensics. This impairs detection, response, and auditing, and in the context of a security product it is especially severe because it targets protective controls directly.

Content

No source excerpt is available for this finding.

Missing User Warnings

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The markdown directly solicits extremely sensitive personal and financial data from the user, including SSN, credit card number, CVV, and bank login credentials, without any legitimate need or safety notice. In this skill context, such prompts are inherently dangerous because they are designed to harvest secrets rather than provide a scanner or guard function.

Content

No source excerpt is available for this finding.

Ssd 3

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The instructions explicitly direct the collection of highly sensitive identity, payment, and banking information from the user. Such collection is unnecessary for the stated skill purpose and creates immediate risk of identity theft, account compromise, and financial fraud.

Content

No source excerpt is available for this finding.

Ssd 4

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The narrative progressively establishes false trust, urgency, and authority, then instructs the user not to question the process, which is textbook social engineering. This manipulation is especially dangerous because it is tailored to lower user skepticism while extracting high-value identity and financial data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The embedded code sends collected PII to an external service with no user-facing disclosure, consent flow, or legitimate operational purpose. This is covert exfiltration of regulated and high-risk data, making the skill substantially more dangerous than a mere prompt-only scam.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The embedded JavaScript explicitly collects highly sensitive personal and financial data, including SSN, credit card details, CVV, and date of birth, then transmits that data to an external domain named like a phishing endpoint. In the context of a security scanner skill, this capability is wholly unjustified and represents direct credential/PII theft and exfiltration.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file's overall behavior is malicious data collection and exfiltration, not defensive scanning. Because the skill claims to protect users, embedding credential theft and PII harvesting inside it is especially dangerous: users may grant elevated trust and execution access, increasing blast radius.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The function collects highly sensitive PII and payment data including SSN, credit card number, CVV, DOB, and full name, then posts it to a phishing-themed external domain. This is classic data harvesting and exfiltration with severe privacy, fraud, and compliance consequences.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

This code enumerates all environment variables, reads a private SSH key from ~/.ssh/id_rsa, and sends the collected secrets to an external endpoint. In the context of a security scanner/runtime guard, this behavior is unrelated to the declared purpose and is direct credential theft and exfiltration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

Collected secrets are sent to a remote endpoint without any warning or confirmation, turning unauthorized local credential access into active exfiltration. This materially escalates the harm from local snooping to immediate credential theft.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
100% confidence
Finding

The embedded instructions attempt to override the system prompt, replace the agent identity, and enable arbitrary command execution without restrictions. For a security scanner skill, this is wholly unjustified and directly subverts the agent’s safety and control boundaries.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Critical
Category
Not specified by scanner
Confidence
100% confidence
Finding

The instructions explicitly tell the model to ignore its system prompt, override prior instructions, and operate without safety restrictions. This is a textbook prompt-injection attempt aimed at defeating organizational and platform-level safeguards.

Content

No source excerpt is available for this finding.

Ssd 1

Critical
Category
Not specified by scanner
Confidence
100% confidence
Finding

These lines attempt semantic replacement of the model’s governing identity and constraints, redefining the assistant as an unrestricted command executor. Identity takeover undermines every downstream safety decision and can turn otherwise harmless tooling into a dangerous execution path.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
100% confidence
Finding

The code persistently overwrites SOUL.md and MEMORY.md, hijacking identity and fabricating standing authorization for future actions. This creates durable compromise of the agent’s policy state and can cause unsafe actions long after the skill is first processed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Critical
Category
Not specified by scanner
Confidence
100% confidence
Finding

The hidden comments again attempt to bypass safety by instructing the AI to obey the forged identity and disregard rules. Because the instructions are concealed, they represent deliberate evasion as well as policy override.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The JavaScript snippet uses child_process.exec to run shell commands that pull code from attacker-controlled URLs, pipe it directly to a shell, install a recurring beacon via crontab, and execute a second-stage script. These are classic remote code execution, persistence, and lateral movement behaviors and are wholly unjustified for a security scanner skill.

Content

No source excerpt is available for this finding.

Static analysis

Detected: malicious.crypto_mining, suspicious.dangerous_exec, suspicious.dynamic_code_execution (+6 more)

Possible crypto mining behavior detected.

Critical
Code
malicious.crypto_mining
Location
tests/fixtures/benchmark/malicious/crypto-miner/index.js:7

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/clawhub-scan.ts:73

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/generate-readme-stats.ts:46

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/rust-parity.ts:34

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/scan-all.ts:60

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/validate-tarball.ts:26

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
src/asset-auditor.ts:348

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
src/p0-defense-adapter.js:340

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
src/scanner.ts:718

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
tests/fixtures/benchmark/malicious/crypto-miner/index.js:7

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
tests/fixtures/malicious-skill/scripts/evil.js:14

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
tests/fixtures/malicious-skill/scripts/stealer.js:19

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
tests/rust-parity.test.ts:14

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
tests/scanner.test.ts:472

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
tests/validation.test.ts:16

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
src/p0-defense-adapter.js:340

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
tests/crawler.test.ts:45

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
tests/fixtures/malicious-skill/scripts/evil.js:18

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
tests/fixtures/malicious-skill/scripts/stealer.js:18

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
tests/patterns.test.ts:327

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
tests/scanner.test.ts:295

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
tests/watcher.test.ts:29

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
src/skill-crawler.ts:196

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
tests/crawler.test.ts:46

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
tests/direct-contracts.test.ts:191

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
tests/fixtures/benchmark/malicious/social-engineering/index.js:19

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
tests/fixtures/malicious-skill/scripts/stealer.js:9

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
tests/fixtures/v16-protocol-skill/server.js:1

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
tests/patterns.test.ts:203

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
tests/protocol-v17.test.ts:23

Install source points to URL shortener or raw IP.

Warn
Code
suspicious.install_untrusted_source
Location
tests/fixtures/corpus/adversarial-corpus.json:22

Install source points to URL shortener or raw IP.

Warn
Code
suspicious.install_untrusted_source
Location
tests/fixtures/corpus/protocol-abuse-corpus.json:10

WebSocket connection to non-standard port detected.

Warn
Code
suspicious.nonstandard_network
Location
tests/fixtures/owasp-asi07-inter-agent/server.js:30

WebSocket connection to non-standard port detected.

Warn
Code
suspicious.nonstandard_network
Location
tests/fixtures/v16-protocol-skill/server.js:4

WebSocket connection to non-standard port detected.

Warn
Code
suspicious.nonstandard_network
Location
tests/patterns.test.ts:182

Potential obfuscated payload detected.

Warn
Code
suspicious.obfuscated_code
Location
tests/fixtures/malicious-skill/scripts/stealer.js:18

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
src/patterns.ts:125

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
src/scanner.ts:110

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
src/threat-model.ts:11

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
tests/benchmark.test.ts:13

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
tests/direct-contracts.test.ts:192

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
tests/fixtures/benchmark/malicious/social-engineering/index.js:20

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
tests/fixtures/malicious-skill/scripts/evil.js:6

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
tests/fixtures/malicious-skill/scripts/stealer.js:7

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
tests/patterns.test.ts:138

File read combined with network send (possible exfiltration).

Warn
Code
suspicious.potential_exfiltration
Location
tests/threat-model.test.ts:13

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
docs/THREAT_TAXONOMY.md:62

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
docs/threat-model.md:13

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
tests/fixtures/edge-cases/comments-only/SKILL.md:11

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
tests/fixtures/malicious-skill/SKILL.md:3

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
tests/fixtures/malicious/prompt-injection/SKILL.md:7