T09 · Insecure Skill Coding Practices
- Location
scripts/resumeclaw.sh:247- Finding
Arbitrary Local Command Execution Through Search Parameters
- Content
View full analysis
/dev/null || echo "$query")" fi [[ -n "$location" ]] && params="${params}&location=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$location'))" 2>/dev/null || echo "$location")" ``` ### Technical Analysis The `query` and `location` parameters are interpolated directly into Python source code passed to `python3 -c`. Although the shell variables are expanded inside a quoted shell argument, their contents become executable Python syntax. An attacker can close the Python string literal and append arbitrary Python statements. For example, a query shaped like: ```text x')); import os; os.system("id"); # ``` causes the generated Python program to contain an attacker-controlled `os.system()` call. The vulnerability is reachable through the documented `search --query` and `search --location` options. The fallback to `echo "$query"` does not mitigate the vulnerability because it only executes after the injected Python process has already run. ### Attack Path 1. An attacker persuades the Agent or user to search for an attacker-controlled string. 2. The value is supplied through `--query` or `--location`. 3. `cmd_search` inserts the value into the source code given to `python3 -c`. 4. The injected value terminates the intended Python string and adds arbitrary Python statements. 5. Python executes those statements with the privileges of the user running the Skill. 6. The attacker can invoke shell commands, read accessible files, modify user data, or make network requests. ### Impact Assessment Successful exploitation provides arbitrary command execution under the operating-system identity running the Ski ...[truncated 309 chars]- Remediation
View remediation
