Back to skill

Security audit

AI Code Review

Security checks for vulnerabilities and agentic risk

Overview

This code-review skill mostly does what it says, but it can automatically modify, commit, and push repository changes without clear user approval or narrow staging safeguards.

Install only if you are comfortable with the agent using GitHub CLI and existing Git credentials during reviews. Before using it, restrict it to read-only review unless you explicitly ask for fixes, and do not allow commit or push actions without reviewing the exact staged diff and target branch.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:96
Finding

Unbounded Repository Staging and Authenticated Remote Push

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 96-106
Vulnerability Type: Excessive repository mutation and unsafe Git staging
Risk Level: High

Vulnerable Code:

bash
# エラーログを読み、根本原因を修正
# 関連するテストケースも更新
# ローカルで同じチェックを実行して検証

# 再プッシュ
git add .
git commit -m "fix: resolve CI failures"
git push

Technical Analysis

The Skill instructs the agent to modify and publish a repository when CI fails on a pull request attributed to the current user. This exceeds the privileges normally required for code review, which should be read-only by default.

The command git add . indiscriminately stages all modified and untracked files under the current working tree. It does not restrict staging to files intentionally changed while resolving the CI failure. The subsequent git push uses the environment's existing Git credentials to publish the commit without requiring explicit user approval, branch verification, staged-diff review, or secret scanning.

This creates a confused-deputy risk: unrelated local changes, generated files, credentials, configuration files, or attacker-influenced content could be included in the commit. Although these instructions do not themselves contain malware, they establish an unsafe privileged workflow.

Attack Path

  1. A user invokes the Skill to review a pull request.
  2. The Skill detects or is told that CI has failed.
  3. Repository content or CI output influences the agent into making local changes.
  4. Unrelated modified or untracked files are present in the working tree, potentially including sensitive files.
  5. The agent executes git add ., staging both intended fixes and unrelated content.
  6. The agent creates a commit without inspecting an allowlisted staged diff.
  7. The agent executes git push using existing authenticated Git credentials.
  8. The unintended content is uploaded to the configured remote repository.

Impact Assessment

The wo ...[truncated 675 chars]

Remediation
View remediation

Remediation Suggestions

  1. Make code review read-only by default and separate review from remediation.
  2. Require explicit user authorization before modifying files.
  3. Require a second explicit confirmation immediately before committing or pushing.
  4. Replace git add . with an allowlist of exact files:
    bash
    git add -- path/to/intended-file
    
  5. Display and validate the staged changes before committing:
    bash
    git diff --cached --stat
    git diff --cached
    
  6. Run secret scanning against staged content before publication.
  7. Verify the repository root, active branch, upstream branch, and remote URL.
  8. Refuse to push directly to protected or unexpected branches.
  9. Prefer generating a patch or suggested diff for the user to review and apply.
  10. Document that CI logs and repository content are untrusted inputs and must not determine commit scope.

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:13
Finding

Unnecessary Access to Agent-Level Configuration Outside the Project

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 13
Vulnerability Type: Cross-boundary access to global agent configuration
Risk Level: Medium

Vulnerable Code:

markdown
このスキルは、以下のガイドライン(`~/.claude/CLAUDE.md`)に基づいた体系的なコードレビューを提供します:

Technical Analysis

The Skill declares that reviews should be based on ~/.claude/CLAUDE.md, an agent-level file outside the project directory. Access to global configuration is not necessary to provide the declared code-review functionality because the package already includes its own review criteria in SKILL.md and reference.md.

Reading this file crosses the project isolation boundary and may expose private global instructions, environment-specific policies, user preferences, or other sensitive operational context. It also allows external state that was not included in the audited Skill package to influence review behavior.

The document does not explicitly instruct the agent to disclose the file or transmit it over the network. Therefore, the confirmed risk is unnecessary access and unreviewed behavioral influence rather than confirmed data exfiltration.

Attack Path

  1. A user activates the Skill for a project review.
  2. The Skill directs the agent to rely on ~/.claude/CLAUDE.md.
  3. The agent reads configuration outside the requested project scope.
  4. Private or project-independent instructions influence the review.
  5. Sensitive details could be unintentionally reflected in generated review output if the agent quotes or summarizes the external configuration.

Impact Assessment

The Skill may gain read access to agent-level configuration outside the audited project. Potential consequences include:

  • Exposure of private global instructions in review output.
  • Cross-project leakage of contextual information.
  • Unreviewed changes to the Skill's effective behavior.
  • Reduced reproducibility because results depend on external configuratio ...[truncated 129 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the dependency on ~/.claude/CLAUDE.md.
  2. Keep all required review rules within the audited Skill package.
  3. If external configuration is optional, require explicit user permission before reading it.
  4. Clearly identify the exact external file and explain why access is required.
  5. Never quote, summarize, log, commit, or transmit external configuration contents.
  6. Constrain file access to the requested project root wherever possible.
  7. Ensure the Skill behaves safely and reproducibly when no global configuration is available.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (7)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

起動フレーズが『レビューして』『コードをチェック』『品質を確認』のように広く一般的で、通常の会話や軽い依頼でもこのスキルが発火しやすくなっています。このスキルにはCI確認やリポジトリ操作に接続する手順が含まれるため、過剰に広いトリガーは不要な高権限動作を招くリスクを高めます。

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

このスキルは本来『コードレビュー』用途ですが、CI失敗時に原因分析だけでなく修正・commit・pushまで実施する手順を含んでいます。レビュー権限を超えてリポジトリ状態を変更する自動化を誘発し、ユーザーが単にレビューを求めただけでも意図しないコード変更や反映が行われる危険があります。

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

git push はローカル解析を超えてリモートリポジトリへ変更を反映する高権限操作であり、コードレビューという読み取り中心の役割に対して過剰です。誤作動や曖昧な起動条件と組み合わさると、未承認の変更反映、履歴汚染、レビュー対象への不正な介入につながります。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document content is presented entirely in Japanese from the opening description onward, with no indication that users may choose another language or that the guide is intended only for a Japan-specific context. This is a natural-language locale constraint that can violate language-choice policy when not explicitly justified or made optional.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

When-to-use の記述が広く、どの依頼で自動起動すべきかの境界が曖昧です。単独では軽微ですが、このスキルがCI確認や潜在的な変更操作を含むため、曖昧な適用範囲は不要な実行や権限誤用の可能性を増します。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations. At L003 the content begins in Japanese, and the rest of the skill examples continue in Japanese with no indication that users can choose another language or that the skill is intentionally limited to a Japanese-only context.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
reference.md:418