T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:270
- Finding
- Shell Command Injection Through an Unquoted Project Path## Vulnerability Details **File Location**: `SKILL.md`, lines 270-271 **Vulnerability Type**: Shell command injection through unsafe interpolation of user-controlled input **Risk Level**: High ### Vulnerable Code ```bash cd {project_path} ./gradlew --refresh-dependencies ``` ### Technical Analysis The workflow places the user-supplied `project_path` directly into a shell command without quoting, escaping, canonicalization, or structured argument handling. Shell metacharacters in the path can consequently be interpreted as command separators, substitutions, redirections, or pipelines rather than as part of a directory name. Merely checking whether the supplied path exists does not make subsequent shell interpolation safe. For example, unusual but valid directory names can contain shell metacharacters, and validation performed against the raw string may not correspond to how a shell later parses that string. ### Attack Path 1. An attacker creates or identifies an Android project whose supplied path contains shell metacharacters. 2. The attacker provides a value shaped like `/tmp/android-project; attacker-command`. 3. The Skill validates or otherwise accepts the project path. 4. During Gradle synchronization, the Agent constructs and executes: ```bash cd /tmp/android-project; attacker-command ./gradlew --refresh-dependencies ``` 5. The shell treats the injected separator and following text as an independent command. 6. The injected command executes with the same operating-system identity and permissions as the Agent. ### Impact Assessment Successful exploitation permits arbitrary command execution under the Agent's account. Depending on that account's permissions, an attacker could read accessible credentials and source code, modify files outside the Android project, execute additional programs, alter build outputs, or destroy data. The flaw itself does not grant privileges above those already hel ...[truncated 66 chars]
- Remediation
- ## Remediation Suggestions - Do not interpolate the project path into a shell command. - Invoke Gradle through a structured process API, passing the validated project directory through the API's `cwd` parameter and the executable and arguments as separate values. - Canonicalize the path before use and confirm that it points to the expected Android project root. - Reject control characters and unexpected path forms. - If shell execution is unavoidable, apply platform-appropriate shell quoting to the entire path. Structured process invocation remains preferable. - Execute Gradle with the minimum necessary permissions and without access to unrelated credentials.
