T09 · Insecure Skill Coding Practices
- Location
simple-backup.sh:57- Finding
Command Execution Through Unvalidated Arithmetic Configuration
- Content
View full analysis
/dev/null || true ``` ### Technical Analysis `HOURLY_RETENTION_HOURS` is read from the OpenClaw configuration or the process environment without being constrained to a decimal integer. It is subsequently evaluated inside a Bash arithmetic expansion. Bash arithmetic expressions may recursively interpret variable contents as arithmetic syntax. Specially constructed expressions, including expressions involving array subscripts and command substitutions, can cause unintended shell commands to be evaluated. Quoting ordinary shell arguments does not protect a value once it is interpreted as arithmetic syntax. `MAX_DAYS` is also supplied directly to `find` without numeric validation. Although it is not used in arithmetic expansion, malformed or option-like input could disrupt pruning behavior. Both retention settings should be strictly validated. ### Attack Path 1. An attacker obtains the ability to set `HOURLY_RETENTION_HOURS` in the backup process environment or modify the `hourlyRetentionHours` value in `~/.openclaw/openclaw.json`. 2. The attacker supplies a malicious Bash arithmetic expression rather than an integer. 3. A user or automated process runs `simple-backup`. 4. The script completes staging and encryption and reaches hourly backup pruning. 5. Bash evaluates the attacker-controlled value in `$(( ...[truncated 679 chars]- Remediation
View remediation
