Back to skill

Security audit

Clawhub Stats Tracker

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent stats-tracking purpose, but its helper script can execute unsafe local code from a crafted tracked-skill entry and runs a mutable npm package at use time.

Review before installing. The skill appears intended for legitimate ClawHub stats lookup, but only use it with a trusted ~/.clawhub/tracked-skills.json file, avoid arbitrary or copied slug values, and prefer pinning the clawhub CLI version before running the script.

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)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/fetch-stats.sh:26
Finding

Python Code Injection Through an Untrusted Skill Slug

Content
View full analysis

Vulnerability Details

File Location: scripts/fetch-stats.sh, lines 26-27
Vulnerability Type: Python source-code injection
Risk Level: High

Vulnerable Code

bash
for SLUG in $SLUGS; do
  NOTE=$(cat "$CONFIG_FILE" | python3 -c "import sys,json; skills=json.load(sys.stdin)['skills']; print(next((s['note'] for s in skills if s['slug']=='$SLUG'),''))" 2>/dev/null)

Technical Analysis

The script reads each slug from ~/.clawhub/tracked-skills.json and interpolates it directly into source code passed to python3 -c.

Although the shell quotes SLUG in most command arguments, that does not make the value safe for insertion into Python source. A slug containing Python quote characters and expressions can terminate or alter the intended string literal. The injected expression is then evaluated by Python under the privileges of the user running the Skill.

For example, an attacker-controlled slug can alter the generator condition from a simple equality comparison into an expression that invokes __import__("os").system(...). Payloads can be constructed without spaces, avoiding the script's word-splitting behavior.

The configuration file is local rather than directly remote, so exploitation requires the attacker, another compromised process, or an unsafe configuration-generation workflow to modify ~/.clawhub/tracked-skills.json.

Attack Path

  1. An attacker obtains the ability to create or modify an entry in ~/.clawhub/tracked-skills.json.
  2. The attacker places Python syntax in the entry's slug field so that it escapes the intended Python string literal.
  3. The user invokes scripts/fetch-stats.sh, directly or through the Skill.
  4. The shell substitutes the malicious slug into the python3 -c source string.
  5. Python parses the resulting text as executable source code.
  6. The injected expression executes with the operating-system privileges and environment of the user running the S ...[truncated 494 chars]
Remediation
View remediation

Remediation Suggestions

Never interpolate configuration values into Python source code. Pass the slug as a positional argument and treat it strictly as data:

bash
NOTE=$(
  python3 -c '
import json
import sys

target = sys.argv[1]
skills = json.load(sys.stdin)["skills"]
print(next((s.get("note", "") for s in skills if s.get("slug") == target), ""))
' "$SLUG" < "$CONFIG_FILE"
)

Additional hardening should include:

  1. Parse the JSON configuration once rather than invoking Python separately for every entry.
  2. Iterate over records using a null-delimited or structured-data mechanism instead of for SLUG in $SLUGS.
  3. Validate slugs against ClawHub's documented slug syntax, preferably with a strict allowlist such as lowercase letters, digits, and hyphens.
  4. Reject malformed JSON, missing keys, non-string slugs, and unexpected configuration structures with explicit errors.
  5. Avoid suppressing all parser errors with 2>/dev/null, because doing so obscures security-relevant failures.

T08 · Insecure Dependencies

Warning
Location
scripts/fetch-stats.sh:29
Finding

Execution of an Unpinned Mutable npm Dependency

Content
View full analysis

Vulnerability Details

File Location: scripts/fetch-stats.sh, line 29
Vulnerability Type: Unpinned third-party dependency execution
Risk Level: Medium

Vulnerable Code

bash
JSON=$(npx clawhub@latest inspect "$SLUG" --json --no-input 2>/dev/null)

Technical Analysis

The script instructs npx to obtain and execute the mutable latest release of the clawhub npm package during normal operation. The project contains no exact dependency version, lockfile, integrity hash, or other mechanism that binds execution to a previously audited artifact.

Consequently, the effective code executed by this Skill can change after the Skill itself has been reviewed. A compromised npm package, compromised publisher account, malicious future release, or accidental breaking release would be retrieved when the command runs.

--no-input controls ClawHub CLI interaction but does not prevent npm package retrieval or package code execution. Suppression of standard error also makes package-installation warnings and other diagnostic indicators less visible.

Attack Path

  1. The npm package, its publisher account, or its release process is compromised, or an unsafe release is published under the expected package name.
  2. The compromised release becomes the package's latest version.
  3. A user runs the statistics script.
  4. npx clawhub@latest downloads or resolves the mutable release.
  5. npm executes package-controlled code under the user's account.
  6. Malicious package code gains access to the process environment and resources available to that user.

Impact Assessment

A malicious dependency could execute arbitrary code with the privileges of the invoking user. Potential access includes user-readable files, environment variables, npm configuration, user-level credentials available to the process, and network resources.

This finding does not establish that the current clawhub package is malicious. Th ...[truncated 196 chars]

Remediation
View remediation

Remediation Suggestions

Pin the CLI to an exact, reviewed version rather than using the mutable latest tag:

bash
JSON=$(npx --yes clawhub@1.2.3 inspect "$SLUG" --json --no-input)

Replace 1.2.3 with a version that has been reviewed and tested. Also apply the following controls:

  1. Declare the dependency in a package manifest and commit a lockfile containing resolved versions and integrity hashes.
  2. Use npm ci in a controlled installation step rather than downloading executable dependencies during each query.
  3. Consider requiring a separately installed, administrator-approved CLI and verify its version before execution.
  4. Review new versions before updating the pin, including package ownership, release provenance, transitive dependencies, and lifecycle scripts.
  5. Use trusted registries and package-signing or provenance verification where supported.
  6. Do not suppress dependency-resolution errors and warnings unless they are safely logged elsewhere.
  7. Update the commands documented in SKILL.md so users are not instructed to bypass the pinned version.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code generally matches the core declared purpose: it reads ~/.clawhub/tracked-skills.json, uses the public clawhub inspect --json interface, and retrieves operational metrics including stars, downloads, installs, version, and publication timestamps. It does not publish, search, or install skills. However, the description explicitly says it supports single queries, batch queries, and filtering by series, while this script only reads all tracked skills from the config and iterates over every slug. There is no logic for accepting a single target skill or filtering by series. Thus the main behavior is mostly aligned, but some declared capabilities are overstated relative to the supplied code chunk.

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

md
| 查看所有跟踪的 Skill | 运行 `bash scripts/fetch-stats.sh` |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| 查看所有跟踪的 Skill | 运行 `bash scripts/fetch-stats.sh` |

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The listed triggers include broad phrases such as "skill 数据", "发布数据", "installs", and "downloads", which are not narrowly scoped to this specific ClawHub stats skill. Although the file provides some negative examples, these trigger terms could still match many unrelated conversations about software metrics or skills in general, increasing the chance of unintended invocation.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Comments and user-facing messages are written only in Chinese, including error output shown to users. This imposes a specific language/locale without offering a choice or documenting that the skill is intentionally region- or language-specific.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
89% confidence
Finding

The script executes npx clawhub@latest, which fetches and runs whatever package version is current at execution time. This creates a supply-chain risk: a compromised upstream package, typo-squatted dependency path, or malicious newly-published version could lead to arbitrary code execution on the user's machine whenever the script runs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This shell script makes a network-backed CLI call for each tracked skill slug using npx clawhub@latest inspect ... --json. Although the script has comments describing data collection, it does not visibly disclose at runtime that local tracked skill identifiers from ~/.clawhub/tracked-skills.json are being sent to an external service.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.