T09 · Insecure Skill Coding Practices
- Location
SKILL.md:26- Finding
PowerShell Command Injection Through Unescaped Parameter Interpolation
- Content
View full analysis
" $oldUrl = "" $newUrl = "" ``` ### Technical Analysis The Skill instructs the agent to replace these placeholders directly with user-provided values before executing the PowerShell script. The values are inserted into double-quoted PowerShell string literals without escaping or validation. An attacker-controlled value can contain a double quote to terminate the intended string, followed by arbitrary PowerShell statements. Because the resulting content is treated as PowerShell source code, the injected statements execute with the privileges of the user or agent running the generated script. All three parameters—`scanDir`, `oldUrl`, and `newUrl`—are affected. Merely validating that a value resembles a path or URL is insufficient unless validation is strict and values are passed separately from executable source code. ### Attack Path 1. The Skill asks the user for a scan directory, old URL, and new URL. 2. An attacker supplies a value containing a closing quote and additional PowerShell syntax. 3. The agent substitutes the value directly into one of the assignments. 4. The user or agent executes the generated PowerShell script. 5. PowerShell parses the injected content as commands. 6. The attacker's commands run with the privileges of the process executing the script. ### Impact Assessment Successful exploitation provides arbitrary command execution under the current user's security context. Depending on that user's privileges, an attacker could read or modify files, access credentials available to the process, alter repositories beyond the requested scope, install software, or establish persistence. The Skill does not itself obtain elevated privileges, but exploitation inherits all permissions already held by the invoking process. ...[truncated 4 chars]- Remediation
View remediation
