T09 · Insecure Skill Coding Practices
- Location
SKILL.md:81- Finding
Command Injection in Inline Python URL Generation
- Content
View full analysis
' body = '''''' encoded_title = urllib.parse.quote(title) encoded_body = urllib.parse.quote(body) url = f'https://github.com/openclaw/clawhub/issues/new?title={encoded_title}&body={encoded_body}' print(url) " ``` ### Technical Analysis The instructions place issue title and body content directly inside an inline Python program that is itself enclosed in a double-quoted shell argument. No safe argument passing, escaping, or serialization boundary is used. This creates two injection surfaces: 1. Shell metacharacters and command substitutions embedded in substituted issue content may be interpreted by the shell before `python3` starts. 2. Quotes or Python syntax in the title or body may terminate the intended Python string and inject additional Python statements. URL encoding occurs only after the data has already been parsed by the shell and Python interpreter, so it does not mitigate either injection risk. ### Attack Path 1. An attacker supplies a crafted issue title or body containing shell substitution syntax or content that breaks out of the Python string literal. 2. The agent replaces `` or `` with that untrusted content. 3. The agent executes the documented `python3 -c` command. 4. The shell evaluates applicable substitutions, or Python interprets injected statements. 5. Arbitrary commands or Python operations run with the privileges of the user executing the skill. ### Impact Assessment Successful exploitation can execute local commands or Python code under the invoking user's account. The resulting access may include reading files available to that user, modifying project or user files, accessing environment variables and locally available credentials, an ...[truncated 181 chars]- Remediation
View remediation
