T03 · Remote Payload Retrieval and Execution
Error
- Location
- SKILL.md:23
- Finding
- Mutable Remote Shell Script Is Retrieved and Executed Without Integrity Verification<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:23-28` and `SKILL.md:283-288` **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: High ### Vulnerable Code ```bash # Download the guard script curl -o ~/.openclaw/workspace/scripts/conversation-guard.sh \ https://raw.githubusercontent.com/zfanmy/dreammoon-conversation-guard/main/conversation-guard.sh # Make executable chmod +x ~/.openclaw/workspace/scripts/conversation-guard.sh ``` The update instructions repeat the same unsafe retrieval pattern: ```bash # Re-download latest version curl -o ~/.openclaw/workspace/scripts/conversation-guard.sh \ https://raw.githubusercontent.com/zfanmy/dreammoon-conversation-guard/main/conversation-guard.sh chmod +x ~/.openclaw/workspace/scripts/conversation-guard.sh ``` The downloaded file is subsequently loaded into the active shell: ```bash source ~/.openclaw/workspace/scripts/conversation-guard.sh ``` ### Technical Analysis The installation and update procedures retrieve executable shell code from the mutable `main` branch of a personal GitHub repository. The instructions do not pin the download to an immutable commit, verify a cryptographic checksum or signature, or inspect the downloaded content before it is sourced. Because `source` executes commands in the current shell rather than an isolated subprocess, a modified remote script can access the invoking process's environment, alter shell state, redefine commands or functions, read files available to the current user, and execute arbitrary commands with that user's privileges. The network download is relevant to installation, but relying on a mutable branch without integrity verification exceeds the minimum trust necessary. The audited bundled script could instead be installed directly, or an immutable, verified release artifact could be used. ### Attack Path 1. An attacker compromises the repository, maintainer account, publishing workflow, or another mechanism ...[truncated 1182 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Prefer the audited `conversation-guard.sh` bundled with the Skill instead of downloading a second copy at installation time. 2. If remote retrieval is required, pin the URL to an immutable commit hash or a versioned release artifact rather than `main`. 3. Publish and verify a SHA-256 digest or cryptographic signature before installation. 4. Use hardened transfer options: ```bash curl --fail --show-error --location --proto '=https' \ -o conversation-guard.sh.tmp \ 'https://raw.githubusercontent.com/.../<immutable-commit>/conversation-guard.sh' ``` 5. Verify the temporary file before replacing the installed script: ```bash printf '%s %s\n' "$EXPECTED_SHA256" conversation-guard.sh.tmp | sha256sum --check - ``` 6. Install the verified file atomically and with an explicit mode: ```bash install -m 0700 conversation-guard.sh.tmp \ "$HOME/.openclaw/workspace/scripts/conversation-guard.sh" ``` 7. Apply the same controls to the update procedure, and never overwrite a trusted executable until verification succeeds. 8. Consider executing the script as a constrained subprocess rather than sourcing it when access to the caller's complete shell environment is unnecessary. ]]>
