Back to skill

Security audit

Multi Agent

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent multi-agent coordination guide, but it should be reviewed because it directs agents to send project diffs and coordination files to Claude and run mutating git/lock workflows without enough scoping, redaction, or safety guidance.

Install only if you intend to use Claude-based multi-agent workflows and are comfortable reviewing each command before use. Before sending task descriptions, diffs, review results, or synthesis files to another model, check for secrets and proprietary content, redact as needed, and use an approved provider. Treat the git worktree, merge, branch deletion, lock cleanup, and hook examples as manual patterns that need project-specific safeguards.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • 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 (3)

T09 · Insecure Skill Coding Practices

Warning
Location
references/file-claim-lock.md:27
Finding

Non-Atomic File Claim Acquisition Allows Concurrent Edits

Content
View full analysis
"$CLAIM_FILE" ``` ### Technical Analysis The claim protocol uses a check-then-write sequence rather than an atomic acquisition operation. Testing whether the claim file exists and subsequently creating it are separate filesystem operations. Two agents can both evaluate `[ -f "$CLAIM_FILE" ]` before either agent creates the file. Both then write to the same path with shell redirection. The last write determines the recorded owner, but both agents continue under the assumption that they acquired the claim. Ordinary output redirection also truncates an existing file and does not provide exclusive creation semantics. Therefore, the mechanism does not enforce the mutual-exclusion property claimed by the documentation. ### Attack Path 1. Two workers are assigned tasks that modify the same target file. 2. Both derive the same `CLAIM_FILE` path. 3. Both evaluate the existence check before either has written the claim. 4. Both checks report that no active claim exists. 5. Each worker writes its own metadata to the same claim file. 6. Both workers proceed with edits, while only the last writer is shown as the lock owner. 7. Their writes can overwrit ...[truncated 637 chars]
Remediation
View remediation
/dev/null; then # Ownership was acquired atomically. jq -n \ --arg sid "$SESSION_ID" \ --arg file "$FILE" \ --argjson exp "$EXPIRES_AT" \ '{session_id: $sid, file: $file, claimed_at: now | todate, expires_at: $exp}' \ > "$CLAIM_DIR/metadata.json" else # Read and validate the existing owner's metadata. exit 1 fi ``` 2. Alternatively, use `flock` or exclusive file creation with a noclobber operation appropriate to the supported platform. 3. Verify ownership immediately before every protected edit and again before releasing the claim. 4. Only permit the recorded owner to release or refresh an unexpired claim. 5. Handle malformed, partially written, and expired metadata as explicit failure cases. 6. Document whether the mechanism is supported on network filesystems, where atomicity guarantees may differ. 7. Avoid deriving claim names solely by replacing `/` with `_`; use a collision-resistant encoding or hash of a normalized absolute project-relative path. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/task-coordination.md:47
Finding

Unlocked Shared Task Updates Can Lose or Corrupt Coordination State

Content
View full analysis
"${TASKFILE}.tmp" && mv "${TASKFILE}.tmp" "$TASKFILE" ``` ### Technical Analysis The comment states that completion updates require the coordination lock, but the example does not acquire or release that lock. Updating the task board is a read-modify-write operation: `jq` reads the current JSON state, modifies one task in memory, and replaces the shared file. If multiple workers perform this sequence concurrently, each can read the same previous state and later replace the file with a version containing only its own update. This creates a lost-update race. All workers also use the same `${TASKFILE}.tmp` temporary path. Concurrent shell redirections can truncate or interleave access to that path, and one worker can move the temporary file while another still expects it to exist. Atomic `mv` does not make the overall read-modify-write sequence safe when writers do not hold a common lock. ### Attack Path 1. Two or more workers complete different tasks at approximately the same time. 2. Each reads the same version of `tasks.json`. 3. Each attempts to write its modified state to the shared `tasks.json.tmp` path. 4. One worker overwrites or moves the temporary file while another worker is still using it. 5. The final `tasks.json` records only one update, contains an unexpected state, or another worker's update fails. 6. The coordinator acts on inaccurate task status and may repeat, omit, or prematurely advance work. ### Impact Assessment The vulnerability affects the integrity and availability of coordination state within the shared workspace. ...[truncated 453 chars]
Remediation
View remediation
/dev/null; then echo "Unable to acquire task lock" >&2 exit 1 fi trap 'rm -f "$TMPFILE"; rmdir "$LOCKDIR" 2>/dev/null' EXIT TMPFILE=$(mktemp ".coordination/tasks.json.XXXXXX") jq --arg id "$TASK_ID" --arg sid "$SESSION_ID" --arg result "$RESULT_FILE" \ 'if any(.tasks[]; .id == $id and .status == "claimed" and .claimed_by == $sid) then (.tasks[] | select(.id == $id)) |= (.status = "done" | .result = $result) else error("Task is not claimed by this session") end' \ "$TASKFILE" > "$TMPFILE" jq -e . "$TMPFILE" >/dev/null mv "$TMPFILE" "$TASKFILE" TMPFILE="" ``` ]]>

T01 · Skill Instruction Hijacking

Warning
Location
references/review-execution-separation.md:29
Finding

Untrusted Repository and Agent Output Is Embedded in Downstream Agent Instructions

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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 (19)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

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

bash
git worktree add .worktrees/${WORKER_ID} -b work/${WORKER_ID} HEAD
claude -p --cwd .worktrees/${WORKER_ID} "..."

共享 .git 仓库但独立工作目录和 index,彻底消除并发冲突。代价是 merge 阶段冲突集中爆发。三种 merge 策略:git merge --no-ff(保留历史)、cherry-pick(只取最终结果)、git diff main...branch > patch(最安全,人工 review)。清理:git worktree remove + git branch -d。 → 详见

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

Scanner excerpt · references/review-execution-separation.md (reported line 16)May include surrounding context.

  1. Implementation agent:带完整任务上下文,执行编码
bash
claude -p --max-turns 60 \
  "$(cat task-description.md)" \
  > .coordination/impl-output.md

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
91% confidence
Finding

The review-agent step sends task-description.md and git diff main directly to an external model, which can expose proprietary code, secrets, or sensitive requirements to a third-party provider. In this multi-agent review context, the danger is elevated because diffs often contain exactly the most sensitive newly added logic and credentials if they were introduced by mistake.

Content

Scanner excerpt · references/review-execution-separation.md (reported line 28)May include surrounding context.

md
git diff main > .coordination/changes.diff

# Review agent 独立 session
claude -p --max-turns 20 \
  "$(cat <<PROMPT
审查以下代码变更。对照原始需求检查:
1. 功能是否正确实现

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

Scanner excerpt · references/review-execution-separation.md (reported line 52)May include surrounding context.

if [ "$APPROVED" = "false" ]; then ISSUES=$(jq -r '.issues | join("\n")' .coordination/review-result.json)

将 review 问题反馈给 implementation agent(新 session)

claude -p --max-turns 30
"修复以下 review 问题:${ISSUES}" fi

text

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
96% confidence
Finding

The skill explicitly selects an external model provider via the claude CLI and feeds it synthesized coordinator output. In a multi-agent coordination context, that synthesis may contain consolidated findings, internal code details, secrets, or other sensitive workspace data, so invoking an external provider without trust-boundary guidance, approval, or minimization materially increases exfiltration and compliance risk.

Content

Scanner excerpt · references/synthesis-gate.md (reported line 47)May include surrounding context.

  1. Gate 通过后,将 synthesis.md 作为 implementation worker 的输入
bash
claude -p --max-turns 50 \
  "根据以下 synthesis 执行实现。$(cat .coordination/synthesis.md)"

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

Scanner excerpt · references/workspace-isolation.md (reported line 27)May include surrounding context.

  1. Worker agent 启动时 cd 到自己的 worktree
bash
claude -p --cwd ".worktrees/${WORKER_ID}" \
  "在当前目录中完成以下任务:修改 parser.ts..."

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger list contains broad terms such as 'coordinator', 'multi agent', and 'file conflict' that may activate the skill during ordinary technical discussion rather than an intentional request to use this coordination pattern. Over-broad activation increases the chance that operational guidance, shell snippets, and workflow instructions are injected into unrelated sessions, which can steer agent behavior unexpectedly.

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 63)May include surrounding context.

}

text

四状态:`pending → claimed → done/failed`。领取任务通过原子锁 `mkdir ".coordination/tasks.lock"`(POSIX 上 mkdir 是原子操作),10 次重试,指数退避 50-500ms,释放用 `rmdir`。

Claude Code Swarm 使用 per-agent inbox `~/.claude/teams/{team}/inboxes/{agent}.json` 替代共享 tasks.json,减少锁竞争。 → [详见](references/task-coordination.md)

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 63)May include surrounding context.

}

text

四状态:`pending → claimed → done/failed`。领取任务通过原子锁 `mkdir ".coordination/tasks.lock"`(POSIX 上 mkdir 是原子操作),10 次重试,指数退避 50-500ms,释放用 `rmdir`。

Claude Code Swarm 使用 per-agent inbox `~/.claude/teams/{team}/inboxes/{agent}.json` 替代共享 tasks.json,减少锁竞争。 → [详见](references/task-coordination.md)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This section includes impactful shell operations such as creating/removing git worktrees, deleting branches, and cleanup commands, but the document does not prominently warn that these commands mutate the repository and may delete local state if used incorrectly. In a skill that may be auto-invoked, omission of safety warnings raises the risk of unintended destructive actions by downstream agents or operators.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire skill reference is written in Chinese and does not indicate that language selection is optional or limited to a justified region-specific audience. Per the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The instructional content is written in Chinese throughout the body of the markdown file, while no natural-language note offers alternative languages or explains that the skill is intentionally region- or locale-specific. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The natural-language content and user-facing denial message are presented only in Chinese, which imposes a specific language on users without documenting any opt-in or locale constraint. Under the policy for this audit, forcing a specific language without user choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents all substantive instructions and examples in Chinese, which effectively forces a specific language for users consuming the skill guidance. The policy only permits this when the skill offers a language choice or the locale constraint is clearly documented and justified, neither of which appears here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document instructs the coordinator to inline the full contents of .coordination/synthesis.md into a claude CLI prompt, which sends that content to an external model process. Because synthesis output may aggregate sensitive research results, this creates a data-exposure risk if users are not explicitly warned, given a chance to redact, or directed to enforce data-handling boundaries.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The substantive instructional content is written in Chinese throughout the document, with no indication that users may choose another language or that the skill is intended only for a Chinese-speaking or region-specific context. This can violate language/locale policy when a skill imposes a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The example command embeds a Chinese instruction string: "在当前目录中完成以下任务:修改 parser.ts...". Because SQP-3 applies to all file types and covers language/locale policy violations, this is a natural-language example that assumes a specific language without any opt-in or alternative language guidance.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The gate requires specific section names matching Chinese or English patterns only, and the example implementation prompt is written in Chinese. This can impose a language expectation without explicit user opt-in or a documented reason that the skill is intended only for those locales.

Content

No source excerpt is available for this finding.