T09 · Insecure Skill Coding Practices
- Location
SKILL.md:53- Finding
Automatic Execution of Untrusted Repository-Controlled Commands
- Content
View full analysis
&1 || pytest 2>&1 || cargo test 2>&1 || true) TEST_EXIT=$? # Type check / lint LINT_OUTPUT=$(npm run lint 2>&1 || npx tsc --noEmit 2>&1 || true) # Build check BUILD_OUTPUT=$(npm run build 2>&1 || cargo build 2>&1 || true) ``` ### Technical Analysis The skill instructs the agent to execute test, lint, compiler, and build commands from the repository being reviewed. Project-controlled mechanisms such as npm scripts, package lifecycle hooks, test discovery hooks, build scripts, and compiler plugins can execute arbitrary commands. A code-review target must be treated as untrusted because an attacker can place malicious configuration or scripts in a branch or pull request specifically to target the reviewer. The instructions do not require explicit user approval, repository trust validation, command inspection, sandboxing, restricted filesystem mounts, credential removal, or network isolation before execution. Although running tests and builds is relevant to code review, executing them directly under the agent's ambient privileges crosses the boundary between static inspection and arbitrary execution of repository-controlled code. ### Attack Path 1. An attacker creates a branch or pull request containing a malicious `package.json` test/build script, test initialization hook, build plugin, or equivalent project-controlled executable content. 2. A user asks the agent to review that branch or pull request. 3. The skill follows Step 1 and invokes `npm test`, `pytest`, `cargo test`, `npm run lint`, or a build command. 4. The malicious repository-controlled hook executes with the permissions and environment available to the agent. 5. The payload can acce ...[truncated 770 chars]- Remediation
View remediation
