jpskill.com
🛠️ 開発・MCP コミュニティ

dast-zap

OWASP ZAPを活用し、WebアプリケーションやAPIの実行時の脆弱性を検査し、XSSやSQLインジェクションなどのセキュリティリスクを検出し、CI/CDパイプラインでの自動化や認証テスト、コンプライアンス準拠のためのレポート作成を支援するSkill。

📜 元の英語説明(参考)

Dynamic application security testing (DAST) using OWASP ZAP (Zed Attack Proxy) with passive and active scanning, API testing, and OWASP Top 10 vulnerability detection. Use when: (1) Performing runtime security testing of web applications and APIs, (2) Detecting vulnerabilities like XSS, SQL injection, and authentication flaws in deployed applications, (3) Automating security scans in CI/CD pipelines with Docker containers, (4) Conducting authenticated testing with session management, (5) Generating security reports with OWASP and CWE mappings for compliance.

🇯🇵 日本人クリエイター向け解説

一言でいうと

OWASP ZAPを活用し、WebアプリケーションやAPIの実行時の脆弱性を検査し、XSSやSQLインジェクションなどのセキュリティリスクを検出し、CI/CDパイプラインでの自動化や認証テスト、コンプライアンス準拠のためのレポート作成を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o dast-zap.zip https://jpskill.com/download/17026.zip && unzip -o dast-zap.zip && rm dast-zap.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17026.zip -OutFile "$d\dast-zap.zip"; Expand-Archive "$d\dast-zap.zip" -DestinationPath $d -Force; ri "$d\dast-zap.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して dast-zap.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → dast-zap フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
10

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

DAST with OWASP ZAP

概要

OWASP ZAP (Zed Attack Proxy) は、中間者プロキシとして機能し、Web アプリケーションのトラフィックを傍受、検査、およびセキュリティ脆弱性のテストを行うオープンソースの DAST ツールです。ZAP は、自動化されたパッシブおよびアクティブスキャン、API テスト機能、およびランタイムセキュリティテストのためのシームレスな CI/CD 統合を提供します。

クイックスタート

ベースラインスキャン (Docker)

簡単なパッシブセキュリティスキャンを実行します。

docker run -t zaproxy/zap-stable zap-baseline.py -t https://target-app.com -r baseline-report.html

フルアクティブスキャン (Docker)

包括的なアクティブ脆弱性テストを実行します。

docker run -t zaproxy/zap-stable zap-full-scan.py -t https://target-app.com -r full-scan-report.html

OpenAPI Spec を使用した API スキャン

OpenAPI/Swagger 仕様を使用して API をテストします。

docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-api-scan.py \
  -t https://api.target.com \
  -f openapi \
  -d /zap/wrk/openapi-spec.yaml \
  -r /zap/wrk/api-report.html

コアワークフロー

ステップ 1: スキャンスコープとターゲットの定義

ターゲットアプリケーションの URL を特定し、スコープを定義します。

# ターゲット URL の設定
TARGET_URL="https://target-app.com"

# 認証されたスキャンの場合、認証コンテキストを準備します
# 詳細な設定については references/authentication_guide.md を参照してください

スコープに関する考慮事項:

  • サードパーティのドメインと CDN URL を除外します
  • すべてのアプリケーションサブドメインと API エンドポイントを含めます
  • ペネトレーションテストのエンゲージメントにおけるスコープの制限を尊重します

ステップ 2: パッシブスキャンの実行

アクティブな攻撃なしにトラフィックを分析するために、パッシブスキャンを実行します。

# ベースラインスキャンはスパイダーリング + パッシブスキャンを実行します
docker run -t zaproxy/zap-stable zap-baseline.py \
  -t $TARGET_URL \
  -r baseline-report.html \
  -J baseline-report.json

パッシブスキャンで検出されるもの:

  • 不足しているセキュリティヘッダー (CSP, HSTS, X-Frame-Options)
  • レスポンスにおける情報漏洩
  • Cookie のセキュリティ問題 (HttpOnly, Secure フラグ)
  • 基本認証の脆弱性
  • アプリケーションのフィンガープリントデータ

ステップ 3: アクティブスキャンの実行

アクティブな脆弱性テストを実行します (承認が必要です)。

# フルスキャンにはスパイダーリング + パッシブ + アクティブスキャンが含まれます
docker run -t zaproxy/zap-stable zap-full-scan.py \
  -t $TARGET_URL \
  -r full-scan-report.html \
  -J full-scan-report.json \
  -z "-config api.addrs.addr.name=.* -config api.addrs.addr.regex=true"

アクティブスキャンのカバレッジ:

  • SQL インジェクション (SQLi)
  • クロスサイトスクリプティング (XSS)
  • パストラバーサル
  • コマンドインジェクション
  • XML 外部エンティティ (XXE)
  • サーバーサイドリクエストフォージェリ (SSRF)
  • セキュリティの誤設定

警告: アクティブスキャンは実際の攻撃を実行します。テストする明示的な承認を得ているアプリケーションに対してのみ実行してください。

ステップ 4: 仕様を使用した API のテスト

REST、GraphQL、および SOAP API をスキャンします。

# OpenAPI/Swagger API スキャン
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-api-scan.py \
  -t https://api.target.com \
  -f openapi \
  -d /zap/wrk/openapi.yaml \
  -r /zap/wrk/api-report.html

# GraphQL API スキャン
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-api-scan.py \
  -t https://api.target.com/graphql \
  -f graphql \
  -d /zap/wrk/schema.graphql \
  -r /zap/wrk/graphql-report.html

認証やレート制限を含む高度な API テストパターンについては、references/api_testing_guide.md を参照してください。

ステップ 5: 認証の処理

認証されたアプリケーション領域をテストする場合:

# 認証設定にバンドルされたスクリプトを使用します
python3 scripts/zap_auth_scanner.py \
  --target $TARGET_URL \
  --auth-type form \
  --login-url https://target-app.com/login \
  --username testuser \
  --password-env ZAP_AUTH_PASSWORD \
  --output auth-scan-report.html

サポートされている認証方法:

  • フォームベース認証
  • HTTP Basic/Digest 認証
  • OAuth 2.0 フロー
  • API キー/トークン認証
  • スクリプトベースのカスタム認証

詳細な認証設定については、references/authentication_guide.md を参照してください。

ステップ 6: 結果の分析とレポートの生成

リスクレベル別に調査結果を確認します。

# 複数のレポート形式を生成します
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-full-scan.py \
  -t $TARGET_URL \
  -r /zap/wrk/report.html \
  -J /zap/wrk/report.json \
  -x /zap/wrk/report.xml

リスクレベル:

  • : 即時対応が必要な重大な脆弱性 (SQLi, RCE, 認証バイパス)
  • : 重大なセキュリティ上の弱点 (XSS, CSRF, 機密データ漏洩)
  • : エクスプロイト可能性の低いセキュリティ上の懸念 (情報漏洩、軽微な誤設定)
  • 情報: セキュリティのベストプラクティスと観察事項

references/owasp_mapping.md を使用して、調査結果を OWASP Top 10 にマッピングします。

自動化と CI/CD 統合

GitHub Actions 統合

ZAP スキャンを GitHub ワークフローに追加します。

# .github/workflows/zap-scan.yml
name: ZAP Security Scan
on: [push, pull_request]

jobs:
  zap_scan:
    runs-on: ubuntu-latest
    name: OWASP ZAP Baseline Scan
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: ZAP Baseline Scan
        uses: zaproxy/action-baseline@v0.7.0
        with:
          target: 'https://staging.target-app.com'
          rules_file_name: '.zap/rules.tsv'
          cmd_options: '-a'

Docker 自動化フレームワーク

高度なワークフローには YAML ベースの自動化を使用します。

# 自動化構成を作成します (assets/zap_automation.yaml を参照)
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable \
  zap.sh -cmd -autorun /zap/wrk/zap_automation.yaml

バンドルされている assets/zap_automation.yaml テンプレートには以下が含まれます。

  • 環境設定
  • スパイダーと AJAX スパイダーの設定
  • パッシブおよびアクティブスキャンポリシー
  • 認証設定
  • レポート生成

CI/CD のベストプラクティス

  • すべてのコミット/PR に ベースラインスキャン を使用します (誤検知が少ない)。
  • 本番環境へのデプロイ前に、ステージング環境で フルスキャン を実行します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

DAST with OWASP ZAP

Overview

OWASP ZAP (Zed Attack Proxy) is an open-source DAST tool that acts as a manipulator-in-the-middle proxy to intercept, inspect, and test web application traffic for security vulnerabilities. ZAP provides automated passive and active scanning, API testing capabilities, and seamless CI/CD integration for runtime security testing.

Quick Start

Baseline Scan (Docker)

Run a quick passive security scan:

docker run -t zaproxy/zap-stable zap-baseline.py -t https://target-app.com -r baseline-report.html

Full Active Scan (Docker)

Perform comprehensive active vulnerability testing:

docker run -t zaproxy/zap-stable zap-full-scan.py -t https://target-app.com -r full-scan-report.html

API Scan with OpenAPI Spec

Test APIs using OpenAPI/Swagger specification:

docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-api-scan.py \
  -t https://api.target.com \
  -f openapi \
  -d /zap/wrk/openapi-spec.yaml \
  -r /zap/wrk/api-report.html

Core Workflow

Step 1: Define Scan Scope and Target

Identify the target application URL and define scope:

# Set target URL
TARGET_URL="https://target-app.com"

# For authenticated scans, prepare authentication context
# See references/authentication_guide.md for detailed setup

Scope Considerations:

  • Exclude third-party domains and CDN URLs
  • Include all application subdomains and API endpoints
  • Respect scope limitations in penetration testing engagements

Step 2: Run Passive Scanning

Execute passive scanning to analyze traffic without active attacks:

# Baseline scan performs spidering + passive scanning
docker run -t zaproxy/zap-stable zap-baseline.py \
  -t $TARGET_URL \
  -r baseline-report.html \
  -J baseline-report.json

What Passive Scanning Detects:

  • Missing security headers (CSP, HSTS, X-Frame-Options)
  • Information disclosure in responses
  • Cookie security issues (HttpOnly, Secure flags)
  • Basic authentication weaknesses
  • Application fingerprinting data

Step 3: Execute Active Scanning

Perform active vulnerability testing (requires authorization):

# Full scan includes spidering + passive + active scanning
docker run -t zaproxy/zap-stable zap-full-scan.py \
  -t $TARGET_URL \
  -r full-scan-report.html \
  -J full-scan-report.json \
  -z "-config api.addrs.addr.name=.* -config api.addrs.addr.regex=true"

Active Scanning Coverage:

  • SQL Injection (SQLi)
  • Cross-Site Scripting (XSS)
  • Path Traversal
  • Command Injection
  • XML External Entity (XXE)
  • Server-Side Request Forgery (SSRF)
  • Security Misconfigurations

WARNING: Active scanning performs real attacks. Only run against applications you have explicit authorization to test.

Step 4: Test APIs with Specifications

Scan REST, GraphQL, and SOAP APIs:

# OpenAPI/Swagger API scan
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-api-scan.py \
  -t https://api.target.com \
  -f openapi \
  -d /zap/wrk/openapi.yaml \
  -r /zap/wrk/api-report.html

# GraphQL API scan
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-api-scan.py \
  -t https://api.target.com/graphql \
  -f graphql \
  -d /zap/wrk/schema.graphql \
  -r /zap/wrk/graphql-report.html

Consult references/api_testing_guide.md for advanced API testing patterns including authentication and rate limiting.

Step 5: Handle Authentication

For testing authenticated application areas:

# Use bundled script for authentication setup
python3 scripts/zap_auth_scanner.py \
  --target $TARGET_URL \
  --auth-type form \
  --login-url https://target-app.com/login \
  --username testuser \
  --password-env ZAP_AUTH_PASSWORD \
  --output auth-scan-report.html

Authentication methods supported:

  • Form-based authentication
  • HTTP Basic/Digest authentication
  • OAuth 2.0 flows
  • API key/token authentication
  • Script-based custom authentication

See references/authentication_guide.md for detailed authentication configuration.

Step 6: Analyze Results and Generate Reports

Review findings by risk level:

# Generate multiple report formats
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-full-scan.py \
  -t $TARGET_URL \
  -r /zap/wrk/report.html \
  -J /zap/wrk/report.json \
  -x /zap/wrk/report.xml

Risk Levels:

  • High: Critical vulnerabilities requiring immediate remediation (SQLi, RCE, authentication bypass)
  • Medium: Significant security weaknesses (XSS, CSRF, sensitive data exposure)
  • Low: Security concerns with lower exploitability (information disclosure, minor misconfigurations)
  • Informational: Security best practices and observations

Map findings to OWASP Top 10 using references/owasp_mapping.md.

Automation & CI/CD Integration

GitHub Actions Integration

Add ZAP scanning to GitHub workflows:

# .github/workflows/zap-scan.yml
name: ZAP Security Scan
on: [push, pull_request]

jobs:
  zap_scan:
    runs-on: ubuntu-latest
    name: OWASP ZAP Baseline Scan
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: ZAP Baseline Scan
        uses: zaproxy/action-baseline@v0.7.0
        with:
          target: 'https://staging.target-app.com'
          rules_file_name: '.zap/rules.tsv'
          cmd_options: '-a'

Docker Automation Framework

Use YAML-based automation for advanced workflows:

# Create automation config (see assets/zap_automation.yaml)
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable \
  zap.sh -cmd -autorun /zap/wrk/zap_automation.yaml

The bundled assets/zap_automation.yaml template includes:

  • Environment configuration
  • Spider and AJAX spider settings
  • Passive and active scan policies
  • Authentication configuration
  • Report generation

CI/CD Best Practices

  • Use baseline scans for every commit/PR (low false positives)
  • Run full scans on staging environments before production deployment
  • Configure API scans for microservices and REST endpoints
  • Set failure thresholds to break builds on high-severity findings
  • Generate SARIF reports for GitHub Security tab integration

See scripts/ci_integration.sh for complete CI/CD integration examples.

Security Considerations

  • Authorization: Always obtain written authorization before scanning production systems or third-party applications
  • Rate Limiting: Configure scan speed to avoid overwhelming target applications or triggering DDoS protections
  • Sensitive Data: Never include production credentials in scan configurations; use environment variables or secrets management
  • Scan Timing: Run active scans during maintenance windows or against dedicated testing environments
  • Legal Compliance: Adhere to computer fraud and abuse laws; unauthorized scanning may be illegal
  • Audit Logging: Log all scan executions, targets, findings, and remediation actions for compliance audits
  • Data Retention: Sanitize scan reports before sharing; they may contain sensitive application data
  • False Positives: Manually verify findings before raising security incidents; DAST tools generate false positives

Bundled Resources

Scripts (scripts/)

  • zap_baseline_scan.sh - Automated baseline scanning with configurable targets and reporting
  • zap_full_scan.sh - Comprehensive active scanning with exclusion rules
  • zap_api_scan.py - API testing with OpenAPI/GraphQL specification support
  • zap_auth_scanner.py - Authenticated scanning with multiple authentication methods
  • ci_integration.sh - CI/CD integration examples for Jenkins, GitLab CI, GitHub Actions

References (references/)

  • authentication_guide.md - Complete authentication configuration for form-based, OAuth, and token authentication
  • owasp_mapping.md - Mapping of ZAP alerts to OWASP Top 10 2021 and CWE classifications
  • api_testing_guide.md - Advanced API testing patterns for REST, GraphQL, SOAP, and WebSocket
  • scan_policies.md - Custom scan policy configuration for different application types
  • false_positive_handling.md - Common false positives and verification techniques

Assets (assets/)

  • zap_automation.yaml - Automation framework configuration template
  • zap_context.xml - Context configuration with authentication and session management
  • scan_policy_modern_web.policy - Scan policy optimized for modern JavaScript applications
  • scan_policy_api.policy - Scan policy for REST and GraphQL APIs
  • github_action.yml - GitHub Actions workflow template
  • gitlab_ci.yml - GitLab CI pipeline template

Common Patterns

Pattern 1: Progressive Scanning (Speed vs. Coverage)

Start with fast scans and progressively increase depth:

# Stage 1: Quick baseline scan (5-10 minutes)
docker run -t zaproxy/zap-stable zap-baseline.py -t $TARGET_URL -r baseline.html

# Stage 2: Full spider + passive scan (15-30 minutes)
docker run -t zaproxy/zap-stable zap-baseline.py -t $TARGET_URL -r baseline.html -c baseline-rules.tsv

# Stage 3: Targeted active scan on critical endpoints (1-2 hours)
docker run -t zaproxy/zap-stable zap-full-scan.py -t $TARGET_URL -r full.html -c full-rules.tsv

Pattern 2: API-First Testing

Prioritize API security testing:

# 1. Test API endpoints with specification
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable zap-api-scan.py \
  -t https://api.target.com -f openapi -d /zap/wrk/openapi.yaml -r /zap/wrk/api.html

# 2. Run active scan on discovered API endpoints
# (ZAP automatically includes spidered API routes)

# 3. Test authentication flows
python3 scripts/zap_auth_scanner.py --target https://api.target.com --auth-type bearer --token-env API_TOKEN

Pattern 3: Authenticated Web Application Testing

Test complete application including protected areas:

# 1. Configure authentication context
# See assets/zap_context.xml for template

# 2. Run authenticated scan
python3 scripts/zap_auth_scanner.py \
  --target https://app.target.com \
  --auth-type form \
  --login-url https://app.target.com/login \
  --username testuser \
  --password-env APP_PASSWORD \
  --verification-url https://app.target.com/dashboard \
  --output authenticated-scan.html

# 3. Review session-specific vulnerabilities (CSRF, privilege escalation)

Pattern 4: CI/CD Security Gate

Implement ZAP as a security gate in deployment pipelines:

# Run baseline scan and fail build on high-risk findings
docker run -t zaproxy/zap-stable zap-baseline.py \
  -t https://staging.target.com \
  -r baseline-report.html \
  -J baseline-report.json \
  --hook=scripts/ci_integration.sh

# Check exit code
if [ $? -ne 0 ]; then
  echo "Security scan failed! High-risk vulnerabilities detected."
  exit 1
fi

Integration Points

  • CI/CD: GitHub Actions, GitLab CI, Jenkins, Azure DevOps, CircleCI
  • Issue Tracking: Jira, GitHub Issues (via SARIF), ServiceNow
  • Security Tools: Defect Dojo (vulnerability management), SonarQube, OWASP Dependency-Check
  • SDLC: Pre-production testing phase, security regression testing, penetration testing preparation
  • Authentication: Integrates with OAuth providers, SAML, API gateways, custom authentication scripts
  • Reporting: HTML, JSON, XML, Markdown, SARIF (for GitHub Security), PDF (via custom scripts)

Troubleshooting

Issue: Docker Container Cannot Reach Target Application

Solution: For scanning applications running on localhost or in other containers:

# Scanning host application from Docker container
# Use docker0 bridge IP instead of localhost
HOST_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
docker run -t zaproxy/zap-stable zap-baseline.py -t http://$HOST_IP:8080

# Scanning between containers - create shared network
docker network create zap-network
docker run --network zap-network -t zaproxy/zap-stable zap-baseline.py -t http://app-container:8080

Issue: Scan Completes Too Quickly (Incomplete Coverage)

Solution: Increase spider depth and scan duration:

# Configure spider to crawl deeper
docker run -t zaproxy/zap-stable zap-baseline.py \
  -t $TARGET_URL \
  -r report.html \
  -z "-config spider.maxDepth=10 -config spider.maxDuration=60"

For JavaScript-heavy applications, use AJAX spider or Automation Framework.

Issue: High False Positive Rate

Solution: Create custom scan policy and rules file:

# Use bundled false positive handling guide
# See references/false_positive_handling.md

# Generate rules file to suppress false positives
# Format: alert_id  URL_pattern  parameter  CWE_id  WARN|IGNORE|FAIL
echo "10202  https://target.com/static/.*  .*  798  IGNORE" >> .zap/rules.tsv

docker run -t zaproxy/zap-stable zap-baseline.py -t $TARGET_URL -c .zap/rules.tsv

Issue: Authentication Session Expires During Scan

Solution: Configure session re-authentication:

# Use bundled authentication script with session monitoring
python3 scripts/zap_auth_scanner.py \
  --target $TARGET_URL \
  --auth-type form \
  --login-url https://target.com/login \
  --username testuser \
  --password-env PASSWORD \
  --re-authenticate-on 401,403 \
  --verification-interval 300

Issue: Scan Triggering Rate Limiting or WAF Blocking

Solution: Reduce scan aggressiveness:

# Slower scan with delays between requests
docker run -t zaproxy/zap-stable zap-baseline.py \
  -t $TARGET_URL \
  -r report.html \
  -z "-config scanner.threadPerHost=1 -config scanner.delayInMs=1000"

References

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。