OWASP ZAP

Scanner de sécurité d'applications web gratuit de l'OWASP. Intercepte le trafic, lance des scans actifs/passifs, fuzz, et prend en charge l'API/l'automatisation via REST et des scripts. OWASP's free web application security scanner. Intercepts traffic, runs active/passive scans, fuzzes, and supports API/automation via REST and scripts.

↗ https://www.zaproxy.org

Overview

OWASP ZAP (Zed Attack Proxy) is a fully featured web security testing platform. It includes an intercepting proxy, active/passive scanner, spider, fuzzer, and WebSocket support. It’s the open-source alternative to Burp Suite Pro, with strong automation/CI-CD integration.

Modes

ModeDescription
StandardInteractive with all features enabled
ProtectedOnly scans in-scope targets
SafeNo attack functionality
ATTACKImmediately attacks newly discovered content

Starting ZAP

Launch GUI

zaproxy

Daemon mode (headless) for CI/CD

zaproxy -daemon -port 8080 -config api.addrs.addr.name=.* -config api.addrs.addr.regex=true

Docker (full scan)

docker run -t owasp/zap2docker-stable zap-full-scan.py -t https://target.com

Docker (baseline scan — passive only)

docker run -t owasp/zap2docker-stable zap-baseline.py -t https://target.com

Docker with report

docker run -v $(pwd):/zap/wrk -t owasp/zap2docker-stable \
  zap-full-scan.py -t https://target.com -r report.html

ZAP API / CLI Automation

Via REST API (ZAP running as daemon) Spider a URL

curl "http://localhost:8080/JSON/spider/action/scan/?url=https://target.com&apikey=mykey"

Start active scan

curl "http://localhost:8080/JSON/ascan/action/scan/?url=https://target.com&apikey=mykey"

Get alerts

curl "http://localhost:8080/JSON/alert/view/alerts/?baseurl=https://target.com&apikey=mykey"

ZAP as Proxy (Burp-style)

Configure browser to proxy through 127.0.0.1:8080, then:

  1. Import ZAP CA cert (Tools → Options → Dynamic SSL Certificates)
  2. Browse target to build site map
  3. Use “Active Scan” on discovered content
  4. Use “Fuzzer” (right-click a request) for parameter testing

Automation Framework (YAML)

# zap.yaml
env:
  contexts:
    - name: "Target"
      urls:
        - "https://target.com"
jobs:
  - type: spider
    parameters:
      context: "Target"
  - type: activeScan
    parameters:
      context: "Target"
  - type: report
    parameters:
      template: "traditional-html"
      reportDir: "/zap/wrk"
      reportFile: "report"

Run automation framework

zaproxy -cmd -autorun zap.yaml

Tips

  • Use “Scope” to limit scanning to specific URLs and prevent scanning third-party services
  • Add authentication scripts under “Scripts” → “Authentication” for logged-in scanning
  • The AJAX Spider handles JavaScript-heavy SPAs better than the traditional spider
  • ZAP HUD (Heads Up Display) overlays controls directly in Firefox
Key add-ons
Active Scanner Rules (Advanced) — extra scan rules
FuzzDB Files — built-in fuzzing payloads  
OAST (Out-of-Band OAST Service) — blind injection detection
OpenAPI / GraphQL — API schema import for targeted scanning
Retire.js — identify vulnerable JavaScript libraries

Vue d’ensemble

OWASP ZAP (Zed Attack Proxy) est une plateforme complète de tests de sécurité d’applications web. Elle inclut un proxy d’interception, un scanner actif/passif, un spider, un fuzzer, et le support WebSocket. C’est l’alternative open-source à Burp Suite Pro, avec une forte intégration automatisation/CI-CD.

Modes

ModeDescription
StandardInteractif avec toutes les fonctionnalités activées
ProtectedNe scanne que les cibles dans le scope
SafeAucune fonctionnalité d’attaque
ATTACKAttaque immédiatement le contenu nouvellement découvert

Démarrer ZAP

# Lancer l'interface graphique
zaproxy

# Mode daemon (headless) pour CI/CD
zaproxy -daemon -port 8080 -config api.addrs.addr.name=.* -config api.addrs.addr.regex=true

# Docker (scan complet)
docker run -t owasp/zap2docker-stable zap-full-scan.py -t https://target.com

# Docker (scan de base : passif uniquement)
docker run -t owasp/zap2docker-stable zap-baseline.py -t https://target.com

# Docker avec rapport
docker run -v $(pwd):/zap/wrk -t owasp/zap2docker-stable \
  zap-full-scan.py -t https://target.com -r report.html

API/CLI ZAP pour l’automatisation

# Via l'API REST (ZAP tournant en daemon)
# Explorer une URL (spider)
curl "http://localhost:8080/JSON/spider/action/scan/?url=https://target.com&apikey=mykey"

# Lancer un scan actif
curl "http://localhost:8080/JSON/ascan/action/scan/?url=https://target.com&apikey=mykey"

# Récupérer les alertes
curl "http://localhost:8080/JSON/alert/view/alerts/?baseurl=https://target.com&apikey=mykey"

ZAP en tant que proxy (façon Burp)

Configurer le navigateur pour utiliser le proxy 127.0.0.1:8080, puis :

  1. Importer le certificat CA de ZAP (Tools → Options → Dynamic SSL Certificates)
  2. Naviguer sur la cible pour construire la carte du site
  3. Utiliser « Active Scan » sur le contenu découvert
  4. Utiliser le « Fuzzer » (clic droit sur une requête) pour tester des paramètres

Framework d’automatisation (YAML)

# zap.yaml
env:
  contexts:
    - name: "Target"
      urls:
        - "https://target.com"
jobs:
  - type: spider
    parameters:
      context: "Target"
  - type: activeScan
    parameters:
      context: "Target"
  - type: report
    parameters:
      template: "traditional-html"
      reportDir: "/zap/wrk"
      reportFile: "report"

Lancer le framework d’automatisation

zaproxy -cmd -autorun zap.yaml

Conseils

  • Utiliser « Scope » pour limiter le scan à des URL spécifiques et éviter de scanner des services tiers
  • Ajouter des scripts d’authentification sous « Scripts » → « Authentication » pour le scan en session connectée
  • L’AJAX Spider gère mieux les SPA riches en JavaScript que le spider traditionnel
  • Le ZAP HUD (Heads Up Display) superpose les contrôles directement dans Firefox
Extensions clés
Active Scanner Rules (Advanced) — extra scan rules
FuzzDB Files — built-in fuzzing payloads  
OAST (Out-of-Band OAST Service) — blind injection detection
OpenAPI / GraphQL — API schema import for targeted scanning
Retire.js — identify vulnerable JavaScript libraries