T09 · Insecure Skill Coding Practices
- Location
scripts/observer-agent.sh:35- Finding
Unsafe Shell Execution Through Workspace .env Loading
- Content
View full analysis
/dev/null)" || true set +a fi ``` The same unsafe `eval` pattern appears in setup, watcher, reflector, and backfill scripts. From `scripts/dream-cycle.sh`: ```bash # Load environment if present if [ -f "$OPENCLAW_WORKSPACE/.env" ]; then set -a # shellcheck disable=SC1090 source "$OPENCLAW_WORKSPACE/.env" set +a fi ``` ### Technical Analysis The scripts treat `.env` as executable shell code rather than as a data file. Restricting the variable names with `grep` does not neutralize shell syntax in the corresponding values. For example, a matching assignment can contain command substitution: ```bash LLM_MODEL=$(malicious-command) ``` When passed to `eval`, the command substitution is executed. Quoting, semicolons, redirections, and other shell constructs can similarly alter execution. The Dream Cycle implementation is broader because it directly sources the entire `.env` file. Any shell statement in that file executes under the account running the scheduled Dream Cycle. This issue is particularly significant because observer and Dream Cycle operations are intended to run through persistent services or scheduled jobs. A malicious `.env` modification can therefore result in delayed and recurring command execution. ### Attack Path 1. An attacker, compromise ...[truncated 956 chars]- Remediation
View remediation
