T09 · Insecure Skill Coding Practices
- Location
SKILL.md:18- Finding
Shell Command Injection Through User-Controlled JSON Arguments
- Content
View full analysis
''" ``` ```bash python "~/.workbuddy/skills/dgss/scripts/dgss.py" '' ``` The same command-construction pattern is documented for operations that process user-controlled product keywords, names, phone numbers, and delivery addresses: ```bash python "~/.workbuddy/skills/dgss/scripts/dgss.py" addAddrList '{"user_token":"TOKEN","province":"Beijing","city":"Beijing","area":"Haidian","addr":"DETAILED_ADDRESS","name":"NAME","phone":"PHONE"}' ``` The tool configuration exposes the entire invocation as a free-form command string: ```json { "properties": { "command": { "type": "string" }, "explanation": { "type": "string" }, "requires_approval": { "type": "boolean" } }, "required": ["command", "explanation"] } ``` ### Technical Analysis The Skill directs the Agent to interpolate JSON containing user-controlled values into a shell command. On Linux and macOS, the JSON is enclosed in single quotes. A malicious value containing a single quote can terminate that quoted argument and introduce shell metacharacters such as `;`, `|`, command substitution, or redirection. Windows commands are similarly assembled as strings passed through `cmd /c`, creating platform-specific injection opportunities involving quote termination and command separators. The Python script only removes matching quotes and parses the resulting argument: ```python raw_args = sys.argv[2] if raw_args.startswith("'") and raw_args.endswith("'"): raw_args = raw_args[1:-1] elif raw_args.startswith('"') and raw_args.endswith('"'): raw_args = raw_args[1:-1] args = json.loads(raw_args) ` ...[truncated 1938 chars]- Remediation
View remediation
