---
title: "Réponse à incident — Playbook"
domain: security
subdomain: soc
phase: 03-response
type: snippet
tags: [soc, incident-response, IR, playbook, containment, DFIR]
difficulty: intermediate
status: stable
updated: "2025-05-13"
---
## Phases IR — NIST SP 800-61

| Phase | Objectif | Durée cible P1 | Livrables |
|---|---|---|---|
| **1. Preparation** | Outils, playbooks, accès prêts | Avant l'incident | IR plan, contacts, accès EDR/SIEM |
| **2. Identification** | Détecter et qualifier l'incident | < 30 min | Ticket IR, sévérité confirmée |
| **3. Containment** | Limiter la propagation | < 1h (P1) | Hôte isolé, compte désactivé |
| **4. Eradication** | Supprimer la menace | < 4h (P1) | Malware supprimé, vuln patchée |
| **5. Recovery** | Restaurer et valider | Variable | Service restauré, monitoring actif |
| **6. Lessons Learned** | Améliorer les défenses | J+7 à J+30 | Post-mortem, améliorations |

---

## Checklist IR

<Checklist items={[
  "Ouvrir un ticket IR avec horodatage précis (UTC)",
  "Identifier le patient zéro (premier hôte/user compromis)",
  "Déterminer le scope : combien d'hôtes/users affectés ?",
  "Notifier le responsable sécurité / RSSI (P1/P2)",
  "Décision containment : isoler vs surveiller",
  "Collecter la mémoire volatile AVANT tout redémarrage",
  "Préserver les logs (export hors de l'hôte compromis)",
  "Documenter chaque action avec heure et opérateur",
  "Identifier et révoquer les credentials compromis",
  "Bloquer les IOC réseau (IP C2, domaines) au firewall",
  "Recherche de persistance sur l'hôte compromis",
  "Scan latéral — autres hôtes avec même IOC",
  "Patch ou workaround de la vulnérabilité exploitée",
  "Validation : monitoring renforcé post-containment (72h)",
  "Post-mortem dans les 7 jours"
]} storageKey="soc-ir-checklist" />

---

## Matrice — Isoler vs Surveiller

| Critère | Isoler | Surveiller |
|---|---|---|
| **Ransomware actif** | Toujours | Jamais |
| **Exfiltration en cours** | Oui | Non |
| **C2 confirmé** | Oui (sauf besoin intel) | Parfois (piège) |
| **Asset critique (DC, prod)** | Après coordination métier | Si impact fort |
| **Patient zéro confirmé** | Oui | Non |
| **Attaquant encore actif** | Oui | Si besoin d'attribution |
| **Seul indice, pas de preuve** | Non | Oui |
| **Environnement de test/dev** | Non nécessaire | Oui + monitoring |

<Warning>Ne jamais isoler un Domain Controller sans coordination préalable avec l'équipe infrastructure — l'isolation d'un DC peut rendre un site entier inaccessible.</Warning>

---

## Collecte de preuves — Commandes

### Windows — Evidence Collection

```powershell
$output = "C:\IR\$(hostname)_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
New-Item -ItemType Directory -Path $output -Force

# Mémoire volatile — processus, connexions réseau
Get-Process | Export-Csv "$output\processes.csv" -NoTypeInformation
Get-NetTCPConnection | Export-Csv "$output\netconn.csv" -NoTypeInformation
netstat -nao > "$output\netstat.txt"

# Services et tâches planifiées
Get-Service | Export-Csv "$output\services.csv" -NoTypeInformation
Get-ScheduledTask | Export-Csv "$output\scheduled_tasks.csv" -NoTypeInformation

# Logs de sécurité (dernières 24h)
wevtutil epl Security "$output\Security.evtx" /q:"*[System[TimeCreated[timediff(@SystemTime) <= 86400000]]]"
wevtutil epl System "$output\System.evtx"
wevtutil epl "Microsoft-Windows-PowerShell/Operational" "$output\PowerShell.evtx"

# Registre — clés de persistance
reg export "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "$output\HKLM_Run.reg"
reg export "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "$output\HKCU_Run.reg"

# Utilisateurs et sessions actives
query user > "$output\logged_users.txt"
net user > "$output\local_users.txt"
net localgroup administrators > "$output\local_admins.txt"

# Connexions établies avec hash des process
Get-NetTCPConnection -State Established | ForEach-Object {
  $p = Get-Process -Id $_.OwningProcess -EA 0
  [PSCustomObject]@{
    RemoteIP   = $_.RemoteAddress
    RemotePort = $_.RemotePort
    PID        = $_.OwningProcess
    Process    = $p.Name
    Path       = $p.Path
    Hash       = (Get-FileHash $p.Path -EA 0).Hash
  }
} | Export-Csv "$output\established_conns.csv" -NoTypeInformation

Write-Host "Evidence collected to: $output"
```

### Linux — Evidence Collection

```bash
#!/bin/bash
OUTPUT="/tmp/ir_$(hostname)_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$OUTPUT"

# Processus et connexions
ps auxf > "$OUTPUT/processes.txt"
ss -tulnp > "$OUTPUT/network_sockets.txt"
lsof -i > "$OUTPUT/open_files_network.txt"
netstat -nap 2>/dev/null > "$OUTPUT/netstat.txt"

# Utilisateurs connectés
who > "$OUTPUT/who.txt"
last -n 100 > "$OUTPUT/last.txt"
lastb -n 100 > "$OUTPUT/lastb.txt" 2>/dev/null

# Logs auth
cp /var/log/auth.log "$OUTPUT/" 2>/dev/null
cp /var/log/secure "$OUTPUT/" 2>/dev/null
journalctl --since "24 hours ago" > "$OUTPUT/journal_24h.txt"

# Tâches planifiées
crontab -l > "$OUTPUT/crontab_root.txt" 2>/dev/null
ls -la /etc/cron* > "$OUTPUT/cron_dirs.txt"
cat /etc/crontab > "$OUTPUT/etc_crontab.txt"

# Persistance
systemctl list-units --type=service --state=running > "$OUTPUT/services.txt"
ls -la /etc/systemd/system/ > "$OUTPUT/systemd_units.txt"

# Hash des process actifs
for pid in $(ls /proc | grep -E '^[0-9]+$'); do
  exe=$(readlink /proc/$pid/exe 2>/dev/null)
  [ -n "$exe" ] && echo "$pid $exe $(md5sum $exe 2>/dev/null | cut -d' ' -f1)"
done > "$OUTPUT/process_hashes.txt"

echo "Evidence collected to: $OUTPUT"
tar czf "${OUTPUT}.tar.gz" "$OUTPUT"
```

---

## Procédures d'isolation

### EDR (CrowdStrike / SentinelOne / Defender)

```powershell
# Windows Defender — Isolation via PowerShell
Add-MpPreference -ThreatIDDefaultAction_Actions 6 # Block

# Ou via script Defender ATP isolate device
# Appeler l'API Microsoft Defender pour isoler l'hôte
$token = "{{DEFENDER_TOKEN}}"
$machineId = "{{MACHINE_ID}}"
Invoke-RestMethod -Method POST `
  -Uri "https://api.securitycenter.microsoft.com/api/machines/$machineId/isolate" `
  -Headers @{Authorization = "Bearer $token"} `
  -Body (@{Comment="IR Isolation - P1 incident"; IsolationType="Full"} | ConvertTo-Json) `
  -ContentType "application/json"
```

### Firewall — Blocage IOC réseau

```bash
# Linux iptables — bloquer IP C2
iptables -I OUTPUT -d {{C2_IP}} -j DROP
iptables -I INPUT -s {{C2_IP}} -j DROP
iptables-save > /etc/iptables/rules.v4

# Windows — règle firewall
netsh advfirewall firewall add rule name="IR-Block-C2" `
  dir=out action=block remoteip={{C2_IP}}

# Palo Alto via CLI
set security policy rules ir-block-c2 destination [ {{C2_IP}}/32 ] action deny
```

### Active Directory — Compte compromis

```powershell
# Désactiver immédiatement le compte compromis
Disable-ADAccount -Identity "{{COMPROMISED_USER}}"

# Réinitialiser le mot de passe
Set-ADAccountPassword -Identity "{{COMPROMISED_USER}}" `
  -NewPassword (ConvertTo-SecureString "{{NEW_RANDOM_PASS}}" -AsPlainText -Force) `
  -Reset

# Forcer la déconnexion des sessions Kerberos (invalidate tickets)
$user = Get-ADUser "{{COMPROMISED_USER}}"
Get-ADUser $user -Properties msDS-KeyVersionNumber
Set-ADUser $user -Replace @{'msDS-KeyVersionNumber' = 1}

# Retirer des groupes privilégiés
Remove-ADGroupMember -Identity "Domain Admins" -Members "{{COMPROMISED_USER}}" -Confirm:$false
```

---

## Template communication P1

```
OBJET : [P1 INCIDENT] {{INCIDENT_TYPE}} — {{DATE}} {{HEURE}} UTC

INCIDENT EN COURS — SEVERITY P1

Incident ID : IR-{{YYYYMMDD}}-{{NNN}}
Détecté le  : {{DATE}} à {{HEURE}} UTC
Analyste    : {{ANALYST_NAME}}
Statut      : CONTAINMENT IN PROGRESS

RÉSUMÉ :
{{Description en 3-5 phrases — quoi, qui, impact métier estimé}}

SCOPE CONFIRMÉ :
- Hôtes affectés : {{COUNT}} ({{HOSTNAMES}})
- Utilisateurs compromis : {{COUNT}} ({{USERNAMES}})
- Données potentiellement exposées : {{OUI/NON/EN COURS D'ÉVALUATION}}

ACTIONS EN COURS :
✓ [HH:MM] Isolation de {{HOST}} initiée
✓ [HH:MM] Compte {{USER}} désactivé
⏳ [HH:MM] Analyse forensique en cours
⏳ [HH:MM] Recherche de propagation latérale

PROCHAINE MISE À JOUR : dans 30 minutes ou à changement de statut.

Contact SOC : {{SOC_PHONE}} | {{SOC_SLACK_CHANNEL}}
```

---

## Template post-incident (J+7)

```markdown
# Post-Mortem — IR-{{ID}}

## Chronologie
| Heure (UTC) | Événement |
|---|---|
| {{T0}} | Première occurrence détectable |
| {{T1}} | Alerte SIEM déclenchée |
| {{T2}} | Analyse SOC débutée |
| {{T3}} | Incident confirmé P{{LEVEL}} |
| {{T4}} | Containment initié |
| {{T5}} | Containment complet |
| {{T6}} | Eradication confirmée |
| {{T7}} | Retour à la normale |

## Cause racine
{{RCA en 1-2 paragraphes}}

## Impact
- Durée d'exposition : {{DURATION}}
- Systèmes affectés : {{LIST}}
- Données exposées : {{OUI/NON + détails RGPD si applicable}}

## Ce qui a bien fonctionné
- ...

## Ce qui doit être amélioré
- ...

## Actions correctives
| Action | Responsable | Deadline |
|---|---|---|
| {{ACTION}} | {{TEAM}} | {{DATE}} |
```

<Tip>Ne jamais redémarrer un système compromis avant d'avoir collecté la mémoire volatile — le RAM contient les credentials en clair (si LSASS compromis), les processus actifs, les connexions réseau établies et potentiellement les clés de chiffrement des ransomwares. Utiliser WinPmem (Windows) ou LiME (Linux) pour le dump mémoire.</Tip>
