Back to skill

Security audit

Using Git Worktrees

Security checks for vulnerabilities and agentic risk

Overview

This worktree helper is coherent, but it tells the agent to run dependency/build/test commands and commit .gitignore changes without clear user approval.

Review before installing. Use this only for trusted repositories, and require the agent to ask before editing .gitignore, committing anything, installing dependencies, building, or running tests. A git worktree isolates branch state, not code execution or access to local files, credentials, or network resources.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:103
Finding

Automatic Execution of Unreviewed Project Dependencies

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 103–117
Vulnerability Type: Insecure dependency installation and build execution
Risk Level: Medium

bash
### 3. Run Project Setup

Auto-detect and run appropriate setup:

```bash
# Node.js
if [ -f package.json ]; then npm install; fi

# Rust
if [ -f Cargo.toml ]; then cargo build; fi

# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi

# Go
if [ -f go.mod ]; then go mod download; fi
text

### Technical Analysis

The skill directs the agent to install dependencies or compile a project solely based on the presence of common manifest files. It does not require user confirmation, dependency review, lockfile enforcement, integrity verification, lifecycle-script suppression, or sandboxing.

In particular, `npm install` can execute package lifecycle scripts. Build and installation operations may also process attacker-controlled project configuration or dependency code. Python package installation can execute build backends, while Rust compilation can execute build scripts. Consequently, opening an untrusted repository and invoking this skill may cause code outside the reviewed skill package to execute with the agent process's permissions.

This finding does not demonstrate that the skill itself contains a malicious dependency. The risk arises from automatically trusting and executing dependencies declared by whichever project invokes the skill.

### Attack Path

1. An attacker supplies or compromises a repository containing a supported manifest such as `package.json`, `Cargo.toml`, `requirements.txt`, or `pyproject.toml`.
2. The manifest references a malicious or compromised dependency, or the project contains installation/build configuration that causes attacker-controlled code to run.
3. A user or agent invokes this worktree skill for that repository.
4. The skill creates the isolated worktree and automatically run
...[truncated 1052 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require explicit user approval before running any dependency installation, compilation, build script, or test command in an untrusted repository.
  2. Display the exact command, manifest, lockfile status, and intended network access before execution.
  3. Prefer reproducible, lockfile-enforcing commands where supported:
    • Use npm ci with a committed lockfile instead of unconstrained npm install.
    • Use cargo build --locked.
    • Require pinned and hash-verified Python dependencies, such as pip install --require-hashes -r requirements.txt.
    • Use locked Poetry installation and fail if the lockfile is missing or inconsistent.
  4. Disable package lifecycle scripts when they are unnecessary, for example by initially using npm ci --ignore-scripts, and require separate approval before enabling them.
  5. Run setup and tests in a sandbox or disposable container with least privilege, restricted filesystem mounts, no inherited secrets, and network access disabled or allowlisted.
  6. Avoid exposing SSH agents, cloud credentials, package registry tokens, or unrelated repository data to dependency-installation processes.
  7. Review manifests, lockfiles, source registries, and build hooks before execution. Fail closed when dependencies are unlocked, fetched from untrusted sources, or use unexpected Git/URL references.
  8. Separate dependency download from code-executing build phases so each operation can be reviewed and authorized independently.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (9)

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill is presented as a worktree-creation helper, but its documented behavior goes well beyond that scope by installing dependencies, building code, running tests, and potentially changing repository history. This scope expansion is dangerous because a user or invoking agent may consent to a low-risk filesystem/git operation while the skill silently performs higher-risk command execution and repository modification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The activation description is broad enough that the skill may be invoked in many normal development contexts, increasing the chance that its side effects are triggered unexpectedly. Because the skill also performs setup, tests, and possible commits, overbroad activation materially raises the risk of unnecessary command execution.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 10)May include surrounding context.

md
## Overview

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.

**Core principle:** Systematic directory selection + safety verification = reliable isolation.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SKILL.md (reported line 36)May include surrounding context.

grep -i "worktree.*director" CLAUDE.md 2>/dev/null

text

**If preference specified:** Use it without asking.

### 3. Ask User

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SKILL.md (reported line 199)May include surrounding context.

grep -i "worktree.*director" CLAUDE.md 2>/dev/null

text

**If preference specified:** Use it without asking.

### 3. Ask User

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill directs the agent to modify .gitignore and commit the change automatically if the chosen worktree directory is not ignored. Committing to repository history is a high-trust action unrelated to the narrow task of creating an isolated workspace, and it can create unauthorized history changes or bypass normal review expectations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs committing changes to .gitignore without clearly warning that it will create a repository commit and alter project history. Hidden history-changing actions are dangerous because they can violate workflow controls, introduce unauthorized changes, and surprise users who expected only local workspace preparation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill instructs automatic execution of project-defined setup and test commands such as npm install, poetry install, cargo build, and test runners. These commands can execute untrusted scripts, fetch remote code, consume significant resources, or alter the environment, which is materially riskier than merely creating a git worktree.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill tells the agent to automatically run dependency installation and build commands without warning that these actions may execute package scripts, access the network, or change the local environment. This deprives the user of informed consent for risky operations and can lead to execution of unreviewed project code.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.