Back to skill

Security audit

Exec ClawHub Publish Doctor

Security checks for vulnerabilities and agentic risk

Overview

This is a transparent ClawHub publishing helper, with some security hygiene cautions around token handling, temporary files, and global npm install advice.

Install only if you need ClawHub publish troubleshooting. Treat ClawHub tokens as secrets, avoid pasting them into shared shells, consider replacing the fixed /tmp output paths before running the scripts on multi-user systems, and use pinned verified CLI install commands instead of unpinned global npm or --force guidance.

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

Note
Location
scripts/clawhub_preflight.sh:35
Finding
Predictable Shared Temporary Files Permit Symlink Attacks and Cross-Run Interference<![CDATA[ ## Vulnerability Details **File Location**: `scripts/clawhub_preflight.sh:35-40`; `scripts/clawhub_publish_safe.sh:35-38` **Vulnerability Type**: Predictable temporary-file creation in a shared directory **Risk Level**: Low ### Vulnerable Code `scripts/clawhub_preflight.sh:35-40`: ```bash if command -v clawhub >/dev/null 2>&1; then if clawhub whoami >/tmp/clawhub_whoami.txt 2>/tmp/clawhub_whoami.err; then ok "authenticated with clawhub" else warn "not authenticated. Run: clawhub login --token <clh_token>" fi fi ``` `scripts/clawhub_publish_safe.sh:35-38`: ```bash if ! clawhub whoami >/tmp/clawhub_publish_whoami.out 2>/tmp/clawhub_publish_whoami.err; then echo "ERROR: Not logged in. Run: clawhub login --token <clh_token>" >&2 exit 4 fi ``` ### Technical Analysis Both scripts redirect command output to fixed, predictable filenames under the globally shared `/tmp` directory. Shell redirection opens and truncates these paths before executing `clawhub whoami`. A local user who can anticipate execution may create one of these paths as a symbolic link to another file writable by the victim. If operating-system symlink protections do not block the operation, the redirection follows the link and truncates or overwrites the target. Fixed names also allow concurrent invocations and different users to interfere with one another or consume stale output. The scripts only need the exit status of `clawhub whoami`; retaining its output in persistent shared files is unnecessary. ### Attack Path 1. A local attacker determines that a victim will run one of the scripts. 2. The attacker creates a predictable path, such as `/tmp/clawhub_whoami.txt`, as a symbolic link to a file writable by the victim. 3. The victim executes the script. 4. The shell processes the output redirection before starting `clawhub whoami`. 5. On a system where symlink protections do not prevent it, the linked target is truncated and receives the command output. 6. Alter ...[truncated 791 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Because only the exit status is required, discard both output streams rather than writing files: ```bash if clawhub whoami >/dev/null 2>&1; then ok "authenticated with clawhub" else warn "not authenticated. Run: clawhub login --token <clh_token>" fi ``` Apply the same change to `clawhub_publish_safe.sh`. If diagnostic output must be retained: 1. Create a private temporary directory with `mktemp -d`. 2. Set a restrictive `umask`, such as `umask 077`. 3. Register a cleanup trap. 4. Store all diagnostic files inside the private directory. 5. Do not reuse fixed paths across executions. Example: ```bash umask 077 TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/clawhub.XXXXXX")" trap 'rm -rf -- "$TMP_DIR"' EXIT if ! clawhub whoami >"$TMP_DIR/whoami.out" 2>"$TMP_DIR/whoami.err"; then echo "ERROR: Not logged in. Run: clawhub login --token <clh_token>" >&2 exit 4 fi ``` ]]>

T08 · Insecure Dependencies

Warning
Location
references/error-map.md:48
Finding
Unpinned Global npm Installation Creates Supply-Chain Exposure<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:29`; `references/error-map.md:48` **Vulnerability Type**: Unpinned third-party dependency installation with global scope **Risk Level**: Medium ### Vulnerable Code `SKILL.md:29`: ```bash clawhub login --token <clh_token> ``` The surrounding workflow relies on the preflight installation recommendation in `scripts/clawhub_preflight.sh:10`: ```bash warn "clawhub not found. Install: npm i -g clawhub" ``` `references/error-map.md:48`: ```bash npm i -g clawhub --force ``` A second installation recommendation appears in `scripts/clawhub_publish_safe.sh:31-34`: ```bash if ! command -v clawhub >/dev/null 2>&1; then echo "ERROR: clawhub not found. Install: npm i -g clawhub" >&2 exit 3 fi ``` ### Technical Analysis The documented and emitted remediation commands install the mutable latest version of the `clawhub` npm package globally. No reviewed version, lockfile, integrity digest, or provenance-verification procedure is specified. npm installation may execute package lifecycle scripts with the installing user's privileges. A future compromised, malicious, or unexpectedly incompatible release could therefore execute code during installation. Global installation also increases scope by modifying user-wide or system-wide executable locations. The `--force` recommendation is particularly unsafe because it suppresses npm safeguards and may overwrite an existing installation. This finding concerns unsafe dependency acquisition guidance; the audited project itself does not contain evidence that it automatically runs the npm installation command. ### Attack Path 1. An attacker compromises the relevant npm package, maintainer account, publication token, or a future release. 2. The compromised package version becomes the version selected by the unpinned `npm i -g clawhub` command. 3. A user follows the Skill's installation or repair guidance. 4. npm downloads the mutable release and may execute it ...[truncated 1007 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin installation guidance to a specifically reviewed version: ```bash npm install --global clawhub@<reviewed-version> ``` 2. Remove the `--force` recommendation. If reinstallation is needed, document an explicit uninstall and verified reinstall process instead. 3. Document how users can verify npm package provenance, publisher identity, integrity metadata, and release signatures where available. 4. Prefer a project-local or isolated installation over global installation when operationally possible. 5. Record and periodically review the approved package version. 6. Advise users not to run npm installation with `sudo` or administrative privileges. 7. Where lifecycle scripts are not required, consider an installation policy that disables scripts, followed by explicit validation that the CLI still functions: ```bash npm install --global --ignore-scripts clawhub@<reviewed-version> ``` 8. Ensure all installation messages in the scripts and documentation use the same pinned, reviewed command. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding
The code chunk is narrowly focused on safely running `gh search repos` with fallback handling for JSON field schema differences. That aligns with one specific item in the description: fixing GitHub CLI `Unknown JSON field` errors. However, the declared purpose broadly claims diagnosis and mitigation for multiple ClawHub publishing and exec-related failure modes—authentication, browser login, missing dependencies in general, security scan visibility, wrong URLs, and publish/report issues—which are not implemented here. Aside from checking whether `gh` is installed, the script does not perform the broader troubleshooting described. Therefore the description materially overstates the code's purpose and coverage.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill instructs users to authenticate with a raw token placeholder but does not provide any guidance on secure secret handling. In practice, users may paste tokens directly into shell history, shared terminals, logs, screenshots, or process lists, which can lead to credential disclosure and unauthorized access to the ClawHub account.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The script redirects `clawhub whoami` stdout and stderr to fixed paths in `/tmp`, which is a shared world-writable directory. Predictable temporary filenames can be abused via symlink or pre-creation attacks, potentially causing sensitive authentication output to be disclosed, overwritten, or redirected to unintended files when the script is run with higher privileges or in multi-user environments.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
This is a code file, so safety-critical operations should include some form of user disclosure unless they are clearly part of the skill's stated purpose. The script performs a remote publish operation immediately after argument validation, but there is no confirmation step or warning that it will create or update a published artifact on the external service.

Static analysis

No suspicious patterns detected.