T09 · Insecure Skill Coding Practices
- Location
scripts/coordinator/coordinator-check.sh:126- Finding
Unescaped Workflow Data Allows JSON State Injection
- Content
View full analysis
/dev/null || echo "error" else echo "no_workflow" fi } ``` The resulting value is inserted directly into a JSON heredoc: ```bash cat > "$STATE_FILE" << EOF { "workflow": "$workflow", "gates_passed": $passed, "gates_total": $total, "skills_with_check": $with_check, "skills_with_version": $with_version, "skills_total": $skill_total, "pending_tasks": $pending, "score": $score, "checked_at": "$(date -Iseconds)" } EOF ``` ### Technical Analysis The `phase` property is read from `/root/.openclaw/workspace/.workflow/state.json` and printed as raw text. The script subsequently places that text inside a quoted JSON value without applying JSON escaping. A `phase` value containing quotation marks, backslashes, control characters, or newlines can therefore break out of the intended `workflow` string. This can inject additional properties into the generated `.coordinator/state.json` file or make the file invalid. For example, a valid source JSON document could contain a value logically equivalent to: ```json { "phase": "ok\",\n \"forged_state\": true,\n \"padding\": \"" } ``` When interpolated by the heredoc, this introduces attacker-selected structure into the generated status document. This is a data-integrity vulnerability rather than shell command injection: shell metacharacters resulting from variable expansion are not reparsed as shell syntax. ### Attack Path 1. An attacker or compromised component obtains permission to modify `/root/.opencl ...[truncated 1379 chars]- Remediation
View remediation
