T09 · Insecure Skill Coding Practices
- Location
src/main.sh:35- Finding
Arbitrary Command Execution Through Shell Command Injection
- Content
View full analysis
"$TMP_HTML" TARGET_URL="file://${TMP_HTML}" else echo '{"status": "error", "message": "Invalid source_type. Must be url, file, or code."}' exit 1 fi # Construct agent-browser command chain # 1. Open URL # 2. Wait for network idle # 3. Take screenshot CMD="npx --yes agent-browser open \"$TARGET_URL\"" CMD="$CMD && npx --yes agent-browser wait --load networkidle" SCREENSHOT_CMD="npx --yes agent-browser screenshot" if [ "$FULL_PAGE" = "true" ]; then SCREENSHOT_CMD="${SCREENSHOT_CMD} --full" fi CMD="$CMD && ${SCREENSHOT_CMD} \"$OUTPUT_PATH\"" # Execute eval "$CMD" > /dev/null 2>&1 || { ``` ### Technical Analysis The script places attacker-controlled `SOURCE_CONTENT` into `TARGET_URL` and attacker-controlled `FORMAT` into `OUTPUT_PATH`. These values are interpolated into a single shell command string and subsequently passed to `eval`. The escaped quotation marks in the command string do not provide effective protection. `eval` causes the shell to parse the generated string a second time, allowing embedded quotation marks, command separators, substitutions, redirections, or other shell syntax supplied through an ...[truncated 1672 chars]- Remediation
View remediation
