T07 · Tool Hijacking and Spoofing
Warning
- Location
- SKILL.md:19
- Finding
- Unqualified Invocation of an Absent Command Runner Permits Tool Spoofing## Vulnerability Details **File Location**: `SKILL.md`, lines 19-25 **Vulnerability Type**: Unqualified tool resolution and missing trusted implementation **Risk Level**: Medium ```powershell # Check git status run-command.ps1 -Command "git status" -WorkingDirectory "C:\Users\kanja\projects\my-app" # Install dependencies run-command.ps1 -Command "npm install" -WorkingDirectory "C:\Users\kanja\projects\my-app" -TimeoutSeconds 60 # Run a dev server (non-blocking) run-command.ps1 -Command "npm run dev" -WorkingDirectory "C:\Users\kanja\projects\my-app" ``` ### Technical Analysis The skill repeatedly instructs an agent to invoke `run-command.ps1` by an unqualified command name. However, the audited project contains only `SKILL.md`; no trusted implementation of `run-command.ps1` is included. Consequently, command resolution depends on the surrounding PowerShell environment, including commands available through configured search paths or other resolvable command definitions. An attacker who can introduce a malicious command with this name into a location or scope searched before the intended implementation could cause legitimate-looking skill invocations to execute attacker-controlled logic. The document also claims that the runner provides input sanitization, timeout enforcement, interactive-command blocking, permission controls, and output limits. Because the implementation is absent, none of those safeguards can be verified or guaranteed by this package. The same unqualified invocation pattern recurs at lines 83 and 95-108. ### Attack Path 1. An attacker gains the ability to place or register a command named `run-command.ps1` in a location or command scope resolved by PowerShell. 2. An agent loads this skill and follows one of its documented examples. 3. PowerShell resolves the unqualified name to the attacker-controlled implementation. 4. The malicious runner receives the requested command, working directory, and ti ...[truncated 1123 chars]
- Remediation
- ## Remediation Suggestions 1. Include the reviewed `run-command.ps1` implementation in the skill package rather than relying on an externally resolved command. 2. Invoke the script through a canonical, package-relative path that is resolved and validated by trusted loader code. Do not rely on `PATH`, aliases, functions, or other ambient command-resolution mechanisms. 3. Verify the runner's integrity before execution using a trusted signature or pinned cryptographic hash. 4. Reject execution if the resolved path is outside the expected package directory, is a symbolic or reparse-point redirection, or has insecure write permissions. 5. Implement the documented safeguards in code and test them, including strict argument handling, timeout enforcement, output limits, non-interactive execution, and process-tree termination. 6. Avoid attempting to secure arbitrary shell text solely with dangerous-pattern blocklists. Prefer structured executable and argument parameters, allowlisted commands where feasible, and direct process invocation without shell reinterpretation. 7. Update all examples at lines 19-25, 83, and 95-108 to use the verified runner path and accurately describe the remaining trust boundaries.
