T07 · Tool Hijacking and Spoofing
Error
- Location
- feishu_fetch_and_print.sh:16
- Finding
- Execution of Unverified Code from Outside the Skill Package<![CDATA[ ## Vulnerability Details **File Location**: `feishu_fetch_and_print.sh`, lines 16–36 **Vulnerability Type**: Unverified external script sourcing and execution **Risk Level**: High ### Vulnerable Code ```bash DOWNLOADER="$SCRIPT_DIR/../shared/feishu_downloader.py" INBOUND_DIR="${INBOUND_DIR:-$HOME/.openclaw/media/inbound}" PRINTER="${PRINTER:-}" mkdir -p "$INBOUND_DIR" if [ -z "$PRINTER" ]; then echo "Error: set the PRINTER environment variable to specify a printer, e.g.: PRINTER=MyPrinter ./feishu_fetch_and_print.sh" echo "Available printers: $(lpstat -a 2>/dev/null | awk '{print $1}' | tr '\n' ' ')" exit 1 fi source "$SCRIPT_DIR/../shared/feishu_args.sh" # Download files and collect successful paths DOWNLOADED=() while IFS= read -r line; do echo "$line" if [[ "$line" == SUCCESS:* ]]; then filepath="${line#SUCCESS: }" DOWNLOADED+=("$filepath") fi done < <(python3 "$DOWNLOADER" "${FEISHU_ARGS[@]}" "$INBOUND_DIR") ``` ### Technical Analysis The script loads two executable components from `../shared`, outside the audited Skill directory: - `feishu_args.sh` is loaded using `source`, causing every command in that file to execute inside the current shell process. - `feishu_downloader.py` is executed directly with Python. Neither component is included in the audited artifact. The Skill does not validate their ownership, permissions, content hashes, signatures, or canonical paths before execution. Consequently, the effective behavior of the Skill depends on mutable, unaudited code outside its package. Using `source` is particularly sensitive because the sourced file can modify shell variables and functions, change shell behavior, read inherited environment variables, or execute arbitrary commands. The downloader similarly runs with all filesystem, network, credential, and device access available to the user invoking the Skill. Although the declared functionality legitimately requires communication with Feishu ...[truncated 1692 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Package all required executable components inside the Skill so that the reviewed artifact contains the complete implementation. 2. Avoid `source` for external argument processing. Use a narrow, data-only interface that returns validated values without executing code in the caller’s shell. 3. Resolve dependency paths to canonical locations and reject paths outside an approved Skill directory. 4. Verify dependency ownership and permissions before use. Reject files writable by untrusted users or groups. 5. Pin and verify cryptographic hashes or signatures for executable dependencies before running them. 6. Run the downloader with a restricted environment and only the credentials, filesystem paths, and network permissions required for Feishu retrieval. 7. Validate downloader output before printing: - Require an absolute canonical path. - Confirm that it is a regular, non-symbolic-link file. - Confirm that it remains inside the approved inbound directory. 8. Include the shared downloader and argument-processing files in future security audits. ]]>
