T09 · Insecure Skill Coding Practices
- Location
scripts/grow.sh:261- Finding
Arbitrary Python Code Execution Through Shell-to-Python Source Interpolation
- Content
View full analysis
/dev/null ``` The same unsafe construction pattern also occurs in other Python invocations, including configurable file paths and command options at `scripts/grow.sh:60-88`, `scripts/grow.sh:492-503`, `scripts/grow.sh:581-632`, `scripts/grow.sh:833-846`, `scripts/grow.sh:938-989`, and `scripts/grow.sh:1050-1067`. ### Technical Analysis The script creates Python source code inside a double-quoted shell string and directly inserts values such as `description`, `domain`, `type`, `xp`, and `DATA_FILE`. These values are treated as Python syntax rather than serialized data. For example, a description containing a single quote can terminate the Python string assigned to `description`. Additional Python statements can then be inserted into the generated program. Python provides direct access to operating-system functionality through modules such as `os` and `subprocess`, so successful source injection results in arbitrary command execution. Suppressing standard error with `2>/dev/null` does not prevent exploitation. It only hides syntax errors an ...[truncated 1873 chars]- Remediation
View remediation
