T09 · Insecure Skill Coding Practices
- Location
SKILL.md:40- Finding
Potential Command Injection Through an Unvalidated Session Identifier
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 40 and 51–52; repeated operational guidance at lines 151 and 169
Vulnerability Type: Command injection through unsafe command construction
Risk Level: MediumVulnerable Code
bash payment-intent summarize -s <sessionId>Related execution instructions:
text 1. Obtain sessionId from the current session metadata 2. Execute the command: payment-intent summarize -s <sessionId>Technical Analysis
The skill directs the agent to obtain a session identifier from session metadata and interpolate it into a shell command. It does not require validation, shell-safe quoting, or execution through an argument-array API.
If the underlying agent substitutes the identifier into a command string and passes that string to a shell, shell metacharacters in attacker-influenced metadata could terminate or modify the intended command and append arbitrary commands. Exploitability therefore depends on both the session identifier being attacker-controllable and the agent using shell-based execution rather than a direct process API.
The instructions also rely on the executable name
payment-intentwithout requiring resolution to a trusted absolute path. Although no tool replacement is present in the audited project, an untrusted executable earlier inPATHcould be invoked instead.Attack Path
- An attacker influences or supplies a session identifier containing shell metacharacters and an additional command.
- The agent retrieves that identifier from the current session metadata as instructed.
- The agent substitutes the identifier directly into
payment-intent summarize -s <sessionId>. - The agent executes the resulting string through a shell.
- The shell interprets the metacharacters and executes the injected command with the agent process's privileges.
Impact Assessment
Successful exploitation could execute arbitrary local commands with the privileges of the agent or ski ...[truncated 447 chars]
- Remediation
View remediation
Remediation Suggestions
- Validate the session identifier against a strict allowlist appropriate to its documented format, for example
^[A-Za-z0-9_-]+$, and reject any nonconforming value. - Invoke the program through a direct process API with a fixed argument array, such as
["payment-intent", "summarize", "-s", sessionId], rather than constructing a shell command. - Explicitly prohibit shell evaluation, string concatenation, and constructs such as
sh -c. - Resolve the executable through a trusted absolute path and verify that its ownership and permissions prevent untrusted replacement.
- Run the command with least privilege and restrict its filesystem and network access to what summarization requires.
- Treat command output as untrusted JSON: enforce size limits, parse it with a strict JSON parser, and validate the returned schema before presenting it to the user.
- Update every repeated command example, including the decision flow, so the secure invocation requirement is consistent throughout the skill documentation.
- Validate the session identifier against a strict allowlist appropriate to its documented format, for example
