T09 · Insecure Skill Coding Practices
- Location
SKILL.md:270- Finding
Shell Command Injection Through an Unquoted Project Path
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 270-271
Vulnerability Type: Shell command injection through unsafe interpolation of user-controlled input
Risk Level: HighVulnerable Code
bash cd {project_path} ./gradlew --refresh-dependenciesTechnical Analysis
The workflow places the user-supplied
project_pathdirectly 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
- An attacker creates or identifies an Android project whose supplied path contains shell metacharacters.
- The attacker provides a value shaped like
/tmp/android-project; attacker-command. - The Skill validates or otherwise accepts the project path.
- During Gradle synchronization, the Agent constructs and executes:
bash cd /tmp/android-project; attacker-command ./gradlew --refresh-dependencies - The shell treats the injected separator and following text as an independent command.
- 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
View 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
cwdparameter 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.
