T09 · Insecure Skill Coding Practices
- Location
scripts/agent-del.sh:37- Finding
Arbitrary Python Code Execution Through Unvalidated Agent IDs
- Content
View full analysis
/dev/null) ``` ### Technical Analysis The `aid` variable originates directly from the command-line arguments supplied to `agent-del.sh` through: ```bash AGENT_IDS=("$@") ``` It is then interpolated into a program passed to `python3 -c`. Shell quoting does not make this safe because the expansion changes the Python source code itself. An identifier containing a quote followed by valid Python syntax can terminate the intended string literal and introduce additional Python statements. No validation limits agent IDs to a safe character set, and the script does not pass the value through `sys.argv`, standard input, or another data-only interface. Therefore, an attacker who can control an argument passed to `run-del.sh` or `agent-del.sh` can execute arbitrary Python code with the privileges of the user running the skill. ### Attack Path 1. An attacker influences the agent ID supplied to `run-del.sh` or invokes `agent-del.sh` directly. 2. The crafted value is stored in the `AGENT_IDS` array without validation. 3. The script expands the value into the quoted Python source at line 41. 4. Python parses the injected content as executable code rather than as an agent ID. 5. The injected Python executes with the environment, filesystem access, and operating-system privileges of the skill process. ### Impact Assessment Successful exploitation provides arbitrary local ...[truncated 362 chars]- Remediation
View remediation
