T09 · Insecure Skill Coding Practices
Error
- Location
- references/clawhub_gate.sh:288
- Finding
- Local-only mode still publishes the target Skill<![CDATA[ ## Vulnerability Details **File Location**: `references/clawhub_gate.sh:288-293` **Vulnerability Type**: `T09: Insecure Skill Coding Practices` **Risk Level**: High ### Vulnerable Code ```bash # Phase 2: sync run_sync # Phase 3: ClawScan if [[ "$LOCAL_ONLY" == "true" ]]; then log "Skipping ClawScan (--local-only)" log "Gate PASSED (local only)" exit 0 fi ``` The documented behavior in `SKILL.md` states that `--local-only` performs a quick local analysis without requiring network access. However, `run_sync` is called before `LOCAL_ONLY` is evaluated. `run_sync` invokes: ```bash clawhub sync ``` Consequently, local-only mode still creates or updates a remote ClawHub version. The option only skips subsequent ClawScan polling. ### Technical Analysis This is a control-flow defect that violates the principle of least surprise and the declared network boundary. A user explicitly selecting an offline operation does not provide informed authorization to publish the contents of `SKILL_DIR`. The upload is not necessary for the declared local-analysis functionality and therefore exceeds the minimum privileges and side effects required for that mode. ### Attack Path 1. A user receives or prepares a Skill that should only be inspected locally. 2. The user runs the documented command with `--local-only`. 3. Local static analysis succeeds. 4. The script executes `clawhub sync` using the user's authenticated ClawHub session. 5. Files in the target Skill directory are uploaded or an existing remote version is updated. 6. The script then reports `Gate PASSED (local only)`, concealing the fact that publication already occurred. ### Impact Assessment The vulnerability can cause unauthorized disclosure of source code, credentials accidentally stored in a Skill directory, internal URLs, proprietary instructions, or other unpublished content. It can also modify a public or organization-visible ClawHub package using the user's existing account permiss ...[truncated 168 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions Evaluate `LOCAL_ONLY` immediately after static analysis and before any synchronization or network operation: ```bash if ! run_static_analysis; then fail "Gate FAILED at static analysis" exit 1 fi if [[ "$LOCAL_ONLY" == "true" ]]; then log "Gate PASSED (local only; no network operations performed)" exit 0 fi run_sync wait_for_clawscan "$slug" ``` Additional hardening should include: - Avoid reading the ClawHub token in local-only mode. - Verify that `clawhub`, Python network requests, and any other network-capable subprocesses cannot be invoked on the local-only path. - Add an automated test that replaces `clawhub` with a failing mock and confirms it is never called under `--local-only`. - Update status messages so they clearly distinguish local analysis from publication. ]]>
