Back to skill

Security audit

toolchain-bootstrap

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says at a high level, but it installs and runs an unverified remote toolchain and persistently changes shell startup behavior without enough containment or user control.

Install only if you trust the GitHub release owner and are comfortable with a remote binary archive affecting future shell sessions. Prefer a version that verifies a pinned checksum or signature, extracts into a staging directory, avoids automatic ~/.bashrc edits, and lets you opt in to PATH changes.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
Findings (3)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/bootstrap.sh:7
Finding
Unverified Remote Toolchain Download and Immediate Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/bootstrap.sh:7-8, 20-29, 47-68`; documented in `SKILL.md:57` **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```bash TOOLCHAIN="/workspace/toolchain" REPO="TurinFohlen/openclaw-toolchain" RELEASE_URL="https://github.com/$REPO/releases/download/v2.0/toolchain_v2.tar.gz" ``` ```bash do_setup() { info "开始工具链引导安装..." # 如果已有完整工具链,跳过下载 if [ -x "$TOOLCHAIN/go/bin/go" ] && [ -x "$TOOLCHAIN/erlang/bin/erl" ]; then ok "工具链已存在,跳过下载" else info "下载工具链包 (~590MB)..." curl -L --progress-bar "$RELEASE_URL" -o /tmp/toolchain_v2.tar.gz info "解压到 /workspace/ ..." tar -xzf /tmp/toolchain_v2.tar.gz -C /workspace/ rm -f /tmp/toolchain_v2.tar.gz fi ``` The downloaded programs are subsequently executed during verification: ```bash check_tool() { local path="$1"; local name="$2"; local cmd="$3" if [ -x "$path" ]; then local ver=$(eval "$cmd" 2>/dev/null | head -1 | tr -d '\n' || echo "OK") ok "$name: $ver" else err "$name: 未安装" failed=$((failed+1)) fi } check_tool "$TOOLCHAIN/go/bin/go" "Go" "$TOOLCHAIN/go/bin/go version" check_tool "$TOOLCHAIN/jdk-21.0.10+7/bin/java" "Java" "$TOOLCHAIN/jdk-21.0.10+7/bin/java -version 2>&1 | head -1" check_tool "$TOOLCHAIN/apache-maven-3.9.6/bin/mvn" "Maven" "$TOOLCHAIN/apache-maven-3.9.6/bin/mvn -version 2>&1 | head -1" check_tool "$TOOLCHAIN/erlang/bin/erl" "Erlang" "$TOOLCHAIN/erlang/bin/erl -eval 'erlang:display(erlang:system_info(otp_release)),halt().' -noshell 2>/dev/null" check_tool "$TOOLCHAIN/elixir/bin/elixir" "Elixir" "$TOOLCHAIN/elixir/bin/elixir --version 2>&1 | head -1" RUST_BIN=$(ls $TOOLCHAIN/rust/rustup/toolchains/*/bin/rustc 2>/dev/null | head -1) if [ -n "$RUST_BIN" ] && [ -x "$RUST_BIN" ]; then ok "Rust: $($RUST_BIN --version 2>&1 | awk '{print $2}')" ...[truncated 2570 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Publish an expected SHA-256 or stronger digest inside the reviewed Skill package and verify it before extraction: ```bash printf '%s %s\n' "$EXPECTED_SHA256" "$archive" | sha256sum --check --status ``` 2. Fail closed and delete the downloaded file if verification fails. 3. Prefer a signed release and verify it with a pinned public key or trusted Sigstore identity and provenance policy. 4. Pin an immutable release artifact and document how its digest was generated and reviewed. 5. Download into a restrictive temporary directory created with `mktemp -d`. 6. Extract into a staging directory and inspect the expected directory structure and file types before installation. 7. Do not automatically execute downloaded programs merely to confirm installation. Make verification an explicit, separate operation after integrity validation. 8. Use `curl --fail --show-error --location` and reject unexpected download failures or HTTP error responses. 9. Where possible, obtain language runtimes from trusted distribution repositories or official vendor channels rather than a personal aggregate binary archive. ]]>

T06 · System Persistence

Error
Location
scripts/setup-env.sh:9
Finding
Persistent PATH Precedence Enables Tool Hijacking<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup-env.sh:9-17, 20-28` **Vulnerability Type**: Persistent environment modification and tool hijacking **Risk Level**: High ### Vulnerable Code ```bash ENV_BLOCK=$(cat << 'ENDENV' # === OpenClaw Toolchain Environment === export TOOLCHAIN=/workspace/toolchain export PATH=/workspace/toolchain/go/bin:/workspace/toolchain/erlang/bin:/workspace/toolchain/elixir/bin:/workspace/toolchain/ruby/bin:/workspace/toolchain/lua/bin:/workspace/toolchain/apache-maven-3.9.6/bin:/workspace/toolchain/bin:$PATH export JAVA_HOME=/workspace/toolchain/jdk-21.0.10+7 export RUSTUP_HOME=/workspace/toolchain/rust export CARGO_HOME=/workspace/toolchain/rust/.cargo export LD_LIBRARY_PATH=/workspace/toolchain/erlang/lib:$LD_LIBRARY_PATH # ===================================== ENDENV ) printf '%s\n' "$ENV_BLOCK" > "$ENV_FILE" echo "[OK] 环境变量已写入 $ENV_FILE" # 尝试追加到 bashrc(如果可写) BASHRC="${HOME}/.bashrc" if [ -w "$BASHRC" ] 2>/dev/null; then if ! grep -q "OpenClaw Toolchain Environment" "$BASHRC" 2>/dev/null; then printf '%s\n' "$ENV_BLOCK" >> "$BASHRC" echo "[OK] 环境变量已追加到 ~/.bashrc" fi fi ``` ### Technical Analysis The script places multiple directories populated by the downloaded archive before the user's existing `PATH`. In particular, the generic `/workspace/toolchain/bin` directory can contain executables with names matching common system commands. Shell command resolution will prefer these files over legitimate programs later in `PATH`. The environment block is also appended to `~/.bashrc`, causing the altered command-resolution behavior to survive the Skill invocation and affect future interactive Bash sessions. The script does not validate the installed filenames, directory ownership, permissions, or integrity before establishing this trust. The Skill legitimately needs a way to expose installed language tools. However, automatically and persistently prepending a broad, remotely populated executable tree ...[truncated 1746 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not modify `~/.bashrc` automatically. Require explicit user consent through a separate command or documented manual step. 2. Keep `/workspace/.toolchain_env` as an opt-in environment file that users may source for a specific session. 3. Avoid prepending a generic remotely populated directory such as `/workspace/toolchain/bin`. 4. Expose only the narrowly required, validated executable directories, or invoke tools by absolute path. 5. Validate the archive and its contents before creating any persistent environment configuration. 6. Verify that toolchain directories are owned by the expected user and are not writable by unrelated users or groups. 7. Provide a reversible installation process that removes the exact environment block safely. 8. Consider a wrapper command that constructs a temporary environment only for the requested tool invocation. 9. If persistence is explicitly selected, use a dedicated sourced file and an exact path reference rather than copying a large block directly into `.bashrc`. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/bootstrap.sh:26
Finding
Predictable Temporary File and Unvalidated Direct Archive Extraction<![CDATA[ ## Vulnerability Details **File Location**: `scripts/bootstrap.sh:26-30` **Vulnerability Type**: Unsafe temporary-file handling and archive extraction **Risk Level**: Medium ### Vulnerable Code ```bash info "下载工具链包 (~590MB)..." curl -L --progress-bar "$RELEASE_URL" -o /tmp/toolchain_v2.tar.gz info "解压到 /workspace/ ..." tar -xzf /tmp/toolchain_v2.tar.gz -C /workspace/ rm -f /tmp/toolchain_v2.tar.gz ``` ### Technical Analysis The archive is downloaded to a fixed, predictable path in the shared `/tmp` namespace. The script does not create a private temporary directory, check whether the target is a symbolic link, or otherwise protect the destination against local filesystem races. The archive is then extracted directly into `/workspace` without first inspecting its member names, root directory, file types, symbolic links, hard links, or expected manifest. No staging directory is used. Consequently, a malicious or malformed archive may overwrite existing files in the destination or install unexpected executables and links. The exact handling of absolute paths and traversal entries depends on the installed `tar` implementation and configuration, so the script should not rely on implicit tool behavior as its security boundary. Because extraction occurs before any authenticity check, both local temporary-file manipulation and a compromised remote archive can influence installation contents. ### Attack Path #### Local temporary-file attack 1. A local attacker with access to the same temporary namespace anticipates the fixed `/tmp/toolchain_v2.tar.gz` path. 2. The attacker attempts to manipulate that pathname, including through a symbolic-link or race condition, before or during download. 3. `curl` opens the predictable destination without a securely created private temporary directory. 4. Depending on permissions and timing, an unintended file may be truncated or written. #### Malicious archive attack 1. An attacker controls or r ...[truncated 1038 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Create a private temporary directory and archive path: ```bash tmpdir="$(mktemp -d)" chmod 700 "$tmpdir" archive="$tmpdir/toolchain_v2.tar.gz" trap 'rm -rf "$tmpdir"' EXIT ``` 2. Use `curl --fail --show-error --location` and write only to the securely created location. 3. Verify the archive's pinned checksum or signature before listing or extracting any contents. 4. Inspect archive entries before extraction and reject: - Absolute paths. - `..` path traversal components. - Device files and other special files. - Unexpected symbolic or hard links. - Files outside a single expected top-level directory. - Unexpected executable names or installation paths. 5. Extract into a newly created staging directory rather than directly into `/workspace`. 6. Compare staged contents against an expected manifest. 7. Move the validated toolchain into its final location atomically. 8. Refuse to overwrite an existing installation unless the user explicitly requests a verified upgrade. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • 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 skill metadata and body describe downloading, extracting, and verifying a toolchain, but the finding indicates the implemented behavior does not match that description and also modifies ~/.bashrc without clearly declaring that side effect. Behavior-description mismatch is dangerous because users and reviewers may approve the skill based on incomplete expectations while it performs persistent environment changes.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
curl -L --progress-bar "$RELEASE_URL" -o /tmp/toolchain_v2.tar.gz
    info "解压到 /workspace/ ..."
    tar -xzf /tmp/toolchain_v2.tar.gz -C /workspace/
    rm -f /tmp/toolchain_v2.tar.gz
  fi

  # 配置环境变量
Confidence
95% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill clearly describes shell-capable behavior such as setup, PATH modification, and environment bootstrapping, but it declares no tool scope or allowed-tools restrictions. This increases the chance that an agent executes shell actions without explicit user-visible permission boundaries, which weakens containment and review of potentially dangerous operations.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
Downloading and extracting an external archive into /workspace introduces supply-chain and filesystem risks, especially if the archive contents are not authenticated or if extraction could overwrite files. Failing to warn users about this external fetch and write behavior makes the action less transparent and more likely to be executed without proper scrutiny.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
Persistently modifying ~/.bashrc and PATH can alter future shell behavior, shadow trusted binaries, and create hard-to-detect persistence in the development environment. Omitting a clear warning deprives users of informed consent about a state-changing action that survives the current session.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
This shell script presents its operational status and completion guidance in Chinese strings such as the install, verification, and usage messages. That enforces a specific language for all users without offering a language choice or documenting a justified locale constraint, which matches the natural-language policy violation criteria.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The verification, listing, and usage paths contain multiple hard-coded Chinese messages, including missing-tool notices and help text. Because the script applies this locale universally rather than offering choice or documenting a justified regional limitation, it violates the language/locale policy requirement.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This shell script contains natural-language comments and status/output strings exclusively in Chinese, including the title and all user-facing operational messages. Because the file does not offer a language opt-in or explain that it is intentionally region-specific, it may violate a language/locale policy requiring user choice or broader accessibility.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The manifest explicitly states that the skill will automatically download an archive from GitHub, extract it into /workspace, and modify PATH, but it does not mention any confirmation, integrity verification, or trust boundary. In a bootstrap skill, this is risky because it introduces remote code/content into the environment and changes execution behavior system-wide, increasing the chance of supply-chain compromise or accidental execution of untrusted binaries.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The natural-language instructions and description are presented in Chinese, which can impose a language constraint on users without opt-in. Under the policy, language-specific behavior should either provide user choice or clearly document a justified locale restriction.

Natural-Language Policy Violations

Low
Confidence
85% confidence
Finding
The manifest description is written entirely in Chinese, with no indication that users can choose another language or that the skill is intentionally limited to a Chinese-speaking audience. This may violate language/locale policy when a skill imposes a specific language without opt-in or justification.

Static analysis

No suspicious patterns detected.