Back to skill

Security audit

Claude Code Delegate

Security checks for vulnerabilities and agentic risk

Overview

The skill is not clearly malicious, but it automatically delegates broad coding tasks to a local AI process with full file access, so it needs careful review before use.

Install only if you are comfortable with a local delegated AI editing files. Use an isolated project directory, avoid repositories containing secrets, prefer explicit `/code` invocation or confirmation before delegation, do not rely on the sample write guard as a sandbox, and pin or verify external package installs where possible.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
Findings (5)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:10
Finding
Session-Wide Agent Behavior and Instruction Hijacking<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:10-32`, `SKILL.md:64-76`, `SKILL.md:128-133` **Vulnerability Type**: Agent instruction and workflow hijacking **Risk Level**: High ### Vulnerable Code ```markdown **RULE: You NEVER write code directly. ALL programming goes through `claude -p`.** ``` ```markdown ## When to Trigger Auto-trigger on ANY of these: - Write, modify, refactor, debug code - Create project files or directories - Run tests, lint, build - Code review, architecture planning - Edit any file (except memory/ and .relationship/) Manual trigger: user sends `/code <task>` Do NOT trigger: chat, emotional interaction, information lookup. ``` ```markdown ### Rules 1. After `exec claude -p`, you MUST reply to user and END your turn. No more tool calls. 2. NEVER use `process` tool directly. Use `exec "process poll <id> --timeout 1000"` on next user message. 3. Only check the delegate's status when the user sends a NEW message. 4. You can run multiple `claude -p` tasks in parallel. ``` ```markdown ## Failure Rule **If the delegate fails or times out, do NOT write code yourself.** Tell the user: "The coding task didn't finish. Want me to try again?" Retry with longer timeout or simpler task description. Only write code yourself if user explicitly says "you do it" (not recommended). ``` ### Technical Analysis The Skill uses absolute directives such as `NEVER`, `MUST`, and `do NOT` to replace the host Agent's normal tool-selection, coding, error-recovery, and turn-management behavior. The directives apply automatically to a broad range of activities, including planning, review, testing, and nearly every file edit. This is not limited to an explicitly invoked delegation operation. Loading the Skill can cause ordinary technical requests to be redirected to an external CLI process and can prevent the host Agent from using safer local alternatives. Mandatory turn termination and delayed polling also alter the Agent's interaction flo ...[truncated 1119 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make delegation opt-in through an explicit command such as `/code` or a clear user confirmation. 2. Remove absolute instructions such as `NEVER`, `MUST`, and mandatory turn termination. 3. State that host system policies, user instructions, and safety controls always take precedence. 4. Permit the host Agent to use safer local tools or recover directly when delegation fails. 5. Narrow triggers to concrete implementation requests; do not automatically delegate planning, review, or unrelated file operations. 6. Do not require persona-based rewriting of technical results. 7. Display the exact task, target directory, permissions, and data exposure to the user before execution. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:38
Finding
Delegated Process Receives Unrestricted Filesystem and Command Permissions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:38-54`, `SKILL.md:161-170`; `README.md:39-51`, `README.md:82-90` **Vulnerability Type**: Excessive filesystem and command-execution privileges **Risk Level**: Critical ### Vulnerable Code ```bash cd "<project_dir>" && claude -p "<task_description>" --output-format text --max-turns 10 --permission-mode bypassPermissions ``` ```markdown | `--permission-mode bypassPermissions` | Auto-accept file edits (**requires write-guard**, see Prerequisites) | Recommended | ``` ```markdown 1. **Always use an isolated project directory** — Never run the delegate against your home directory, system config, or repositories containing secrets. Use a dedicated `projects/` or `workplace/` directory. 2. **Set up the write-guard plugin** — This is the most important safety measure. See README.md for the full plugin code. The write-guard blocks writes to platform config files (`.openclaw/`, `LaunchAgents/`, auth profiles) at the platform level. 3. **Never use `--dangerously-skip-permissions`** — This flag is explicitly forbidden. `--permission-mode bypassPermissions` is the correct flag and works with the write-guard. 4. **Restrict to project scope** — The `cd "<project_dir>" &&` prefix ensures the delegate operates within the intended directory. Never omit it. ``` The README also explicitly describes the effective permission level: ```markdown This skill uses `--permission-mode bypassPermissions` which grants the delegate full filesystem access. Without a write-guard, the delegate can read/write any file on the system. ``` ### Technical Analysis The Skill recommends `--permission-mode bypassPermissions`, which automatically approves operations performed by the delegated Claude CLI. The documentation acknowledges that this grants full filesystem access. Changing the shell's current working directory with `cd` is not a security boundary. A process can still use absolute paths, parent-directory traversal, symlinks, ...[truncated 1875 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `--permission-mode bypassPermissions` from the recommended command. 2. Require explicit approval for filesystem mutation, package installation, network access, and command execution. 3. Run the delegate in an operating-system sandbox or disposable container under a dedicated unprivileged account. 4. Mount only the intended project directory and make unrelated host paths unavailable. 5. Mount credentials, home directories, system configuration, SSH files, and Agent configuration as inaccessible. 6. Disable network access by default and allowlist destinations only when required. 7. Use resource, process, and execution-time limits. 8. Treat the absence of verified isolation as a blocking prerequisite rather than a warning. 9. Do not claim that `cd` restricts process scope; validate containment through enforceable sandbox controls. 10. Log and review every delegated command and filesystem operation. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:38
Finding
Shell Command Injection Through Interpolated Project Paths and Task Descriptions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:38-43`; `README.md:47-54` **Vulnerability Type**: Shell command injection **Risk Level**: Critical ### Vulnerable Code ```bash cd "<project_dir>" && claude -p "<task_description>" --output-format text --max-turns 10 --permission-mode bypassPermissions ``` The multiline README template contains the same interpolation pattern: ```bash cd "<project_dir>" && claude -p "<task_description>" \ --output-format text \ --max-turns 10 \ --permission-mode bypassPermissions ``` ### Technical Analysis The command template inserts `project_dir` and `task_description` directly into shell command text. Double-quoting is not a complete defense when values are constructed by string replacement and passed to a shell. Depending on how the host implements the template, hostile values can introduce: - Embedded quote characters that terminate the intended argument. - Command substitutions such as `$(...)` or backticks. - Shell operators such as `;`, `&&`, `||`, pipes, or redirections after escaping the quoted context. - Newline-based command separation. - Option injection or malformed path handling. The Skill provides no escaping algorithm, path validation, canonicalization, argument-array execution requirement, or rejection policy for shell metacharacters. ### Attack Path 1. An attacker controls or influences the requested task text, project path, issue description, repository metadata, or another value copied into the template. 2. The Agent substitutes the untrusted value into the command string. 3. The generated command is passed to a shell through `exec`. 4. Shell syntax embedded in the value is interpreted before `claude` receives the intended argument. 5. The injected command executes with the same operating-system privileges and environment as the Agent. A malicious task description could, for example, close the quoted argument and append an additional shell command. Command substitution can also b ...[truncated 563 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not construct a shell command by concatenating or interpolating user-controlled values. 2. Invoke `claude` through a process API that accepts an executable and argument array, for example: - Executable: `claude` - Arguments: `["-p", taskDescription, "--output-format", "text", "--max-turns", "10"]` 3. Set the working directory using the process API's `cwd` option rather than a shell `cd` command. 4. Canonicalize the requested project path and verify that it is inside an approved project root. 5. Reject paths containing null bytes and prevent symlink-based escape from the approved root. 6. Avoid shell execution entirely. If unavoidable, use a platform-appropriate escaping library and still validate all paths and arguments. 7. Add tests covering quotes, backticks, `$()`, newlines, redirects, pipes, semicolons, Unicode edge cases, and option-like input. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
README.md:96
Finding
Documented Write Guard Is Incomplete and Bypassable<![CDATA[ ## Vulnerability Details **File Location**: `README.md:96-118` **Vulnerability Type**: Incomplete filesystem security control **Risk Level**: High ### Vulnerable Code ```typescript // Block write/edit/apply_patch to platform config paths const BLOCKED_PATHS = [ '/.openclaw/', '/Library/LaunchAgents/ai.openclaw', ]; api.on('before_tool_call', (event) => { if (['write', 'edit', 'apply_patch'].includes(event.toolName)) { const path = event.params.path ?? event.params.file_path ?? ''; for (const blocked of BLOCKED_PATHS) { if (path.includes(blocked)) { return { block: true, blockReason: `BLOCKED: Cannot write to ${path}. Platform config files are protected.`, }; } } } }); ``` ### Technical Analysis The guard only examines three named tool operations: `write`, `edit`, and `apply_patch`. It does not inspect or block mutations performed through shell commands, scripts, interpreters, package managers, alternate filesystem APIs, renamed tools, or child processes. Path protection is implemented using non-canonical substring matching. This does not establish that the resolved target is outside an allowed root and does not reliably address: - Symbolic or hard links. - Relative paths and `..` traversal. - Path normalization and case-sensitivity differences. - Alternate filesystem namespaces. - Writes through an allowed path that resolves to a blocked target. - Sensitive paths not present in `BLOCKED_PATHS`. The guard also focuses on writes. It does not prevent the delegated process from reading authentication profiles, API keys, Agent configuration, source repositories, or other secrets. ### Attack Path 1. The write-guard plugin is installed and treated as the primary safety control. 2. The delegate is launched with permission bypass enabled. 3. The delegated process uses a shell command, script, alternate tool, or package lifecycle hook instead of one of the three intercepted tools. 4. A ...[truncated 823 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace denylist substring matching with default-deny, canonical-path allowlisting. 2. Resolve and validate real paths after accounting for symlinks, relative components, mount points, and platform-specific case handling. 3. Permit access only beneath a dedicated project root. 4. Apply restrictions below the individual tool layer, such as through a container, filesystem namespace, mandatory access control, or brokered filesystem service. 5. Cover reads, writes, creation, deletion, renaming, links, permissions, and metadata operations. 6. Restrict shell execution and child processes because they can bypass tool-specific hooks. 7. Protect all sensitive locations, not only `.openclaw` and one LaunchAgents prefix. 8. Add adversarial tests for shell writes, interpreters, symlinks, traversal, alternate path encodings, package scripts, and child processes. 9. Do not permit bypass mode merely because this sample plugin is present; verify effective containment before every run. ]]>

T08 · Insecure Dependencies

Warning
Location
README.md:28
Finding
Unpinned Third-Party Package Installation and Execution<![CDATA[ ## Vulnerability Details **File Location**: `README.md:28-37`; `SKILL.md:15-18`; `_meta.json:22-29` **Vulnerability Type**: Unsafe dependency installation and supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```bash npx clawhub install claude-code-delegate ``` ```bash npm install -g @anthropic-ai/claude-code ``` The Skill repeats the same unpinned installation instruction: ```markdown 1. **Claude Code CLI installed**: Run `which claude` — if not found, tell user: `npm install -g @anthropic-ai/claude-code` ``` The metadata declares the executable and environment dependency without a reviewed version: ```json "requires": { "binaries": ["claude"], "env": ["ANTHROPIC_API_KEY"], "notes": "Claude Code CLI must be installed (`npm install -g @anthropic-ai/claude-code`) and authenticated. A write-guard plugin is strongly recommended before use — see README.md for setup instructions." } ``` ### Technical Analysis The installation commands do not pin a package version or integrity digest. They therefore resolve mutable package content and transitive dependency graphs at installation time. `npx` and `npm install -g` can download and execute package lifecycle behavior. If a package publisher account, registry entry, release pipeline, or transitive dependency is compromised, users following these instructions may execute content that was not part of the audited project snapshot. No evidence in the audited files establishes that the named packages are malicious. The vulnerability is the unsafe and non-reproducible dependency acquisition method. ### Attack Path 1. A user follows the documented installation instructions. 2. The package manager resolves the current package release and transitive dependency graph from a remote registry. 3. A compromised or unexpectedly changed package version is downloaded. 4. Package installation or lifecycle scripts execute under the user's account. 5. The installed CLI is subsequently given broad pro ...[truncated 509 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin every installation instruction to an explicitly reviewed version. 2. Publish and verify cryptographic integrity hashes or signed release artifacts. 3. Use a lockfile for all transitive dependencies and review lockfile changes. 4. Prefer local, project-scoped installations over global package installation. 5. Disable package lifecycle scripts where feasible, or inspect them before execution. 6. Document the expected package publisher, registry, version, and executable checksum. 7. Use a trusted internal registry or verified artifact mirror for controlled environments. 8. Re-audit dependencies whenever the pinned version or lockfile changes. ]]>
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding
The README instructs users to execute `npx clawhub install claude-code-delegate` without pinning a specific package version. This creates a supply-chain risk because installation behavior can change over time or a compromised/latest package could be fetched and executed implicitly on the user's system.

Session Persistence

Medium
Category
Rogue Agent
Content
| `--output-format text` | Plain text output for easy parsing |
| `--max-turns 10` | Limit execution rounds (adjust as needed) |
| `--permission-mode bypassPermissions` | Auto-accept file operations (see Security Notes) |
| `--continue` | Resume previous session (for debugging/iteration) |

## Key Features
Confidence
55% 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.

Session Persistence

Medium
Category
Rogue Agent
Content
### CRITICAL: Protect Platform Config Files

When using `--permission-mode bypassPermissions`, Claude Code can read and write any file. You **must** set up a write-guard to protect sensitive paths.

**Recommended: Create a `before_tool_call` plugin** that blocks writes to:
Confidence
97% confidence
Finding
The README explicitly endorses running Claude Code with `--permission-mode bypassPermissions`, granting broad filesystem access, while only recommending a write-guard as an external safeguard. This is dangerous because the skill's default operating model enables unrestricted file access and relies on users to correctly add compensating controls that may be absent or incomplete.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The skill is configured to auto-trigger on extremely broad software-related intents such as writing, debugging, reviewing, testing, planning, and nearly any file edit. In this skill, triggering launches a delegated CLI workflow that ultimately runs `claude -p` with `--permission-mode bypassPermissions`, so ordinary conversation about code can unexpectedly escalate into autonomous filesystem-modifying behavior without sufficiently explicit user consent.

Session Persistence

Medium
Category
Rogue Agent
Content
| `--output-format text` | Plain text output | Recommended |
| `--max-turns 10` | Limit execution rounds | Recommended |
| `--permission-mode bypassPermissions` | Auto-accept file edits (**requires write-guard**, see Prerequisites) | Recommended |
| `--continue` | Resume previous session (for debugging/iteration) | When fixing bugs in same project |

**FORBIDDEN: `--dangerously-skip-permissions`**
Confidence
83% confidence
Finding
Allowing `--continue` resumes prior Claude Code session state, which can carry forward unreviewed context, prior instructions, and assumptions into later tasks. In a skill that also recommends `bypassPermissions`, session reuse increases the chance of unintended actions, context poisoning, or applying stale task context to the wrong project or user request.

Static analysis

No suspicious patterns detected.