T09 · Insecure Skill Coding Practices
- Location
scripts/5gc.js:171- Finding
Shell Command Injection Through Forwarded CLI Arguments
- Content
View full analysis
process.exit(code || 0)); child.on('error', (err) => { console.error('Launch failed:', err.message); process.exit(1); }); ``` ### Technical Analysis The dispatcher forwards user-controlled CLI option values to `child_process.spawn()` while enabling `shell: true`. Enabling a shell is unnecessary because Node.js can execute the selected JavaScript file directly. With shell execution enabled, argument values containing shell metacharacters may be interpreted by the platform shell rather than remaining opaque arguments. The entity and action are allowlisted, and the script path comes from a fixed map, but arbitrary option values are preserved by `normalizeChildArgs()` without a comprehensive character or type allowlist. ### Attack Path 1. An attacker obtains the ability to invoke the Skill or influence its CLI parameters. 2. The attacker places shell syntax in a forwarded option value, such as a project name or entity name. 3. `normalizeChildArgs()` preserves the malicious value in `childArgv`. 4. `spawn()` invokes the command through a shell because `shell: true` is configured. 5. The shell interprets the injected syntax and executes an additional local command. 6. The injected command runs with the same operating-system privileges as the Agent or user running the Skill. ### Impact Assessment Successful expl ...[truncated 322 chars]- Remediation
View remediation
