socincident-responseIR
MDstable
NoteSnippetChecklistPlaybook
Réponse à incident — Playbook
Phases IR, containment, éradication, recovery — guide SOC
snippetintermediate 2025-05-13 6 min read
socincident-responseIRplaybookcontainmentDFIR
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
Checklist0/15
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 |
⚠ Attention — 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.
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éseauGet-Process | Export-Csv "$output\processes.csv" -NoTypeInformationGet-NetTCPConnection | Export-Csv "$output\netconn.csv" -NoTypeInformationnetstat -nao > "$output\netstat.txt"# Services et tâches planifiéesGet-Service | Export-Csv "$output\services.csv" -NoTypeInformationGet-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 persistancereg 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 activesquery user > "$output\logged_users.txt"net user > "$output\local_users.txt"net localgroup administrators > "$output\local_admins.txt"# Connexions établies avec hash des processGet-NetTCPConnection -State Established | ForEach-Object {$p = Get-Process -Id $_.OwningProcess -EA 0[PSCustomObject]@{RemoteIP = $_.RemoteAddressRemotePort = $_.RemotePortPID = $_.OwningProcessProcess = $p.NamePath = $p.PathHash = (Get-FileHash $p.Path -EA 0).Hash}} | Export-Csv "$output\established_conns.csv" -NoTypeInformationWrite-Host "Evidence collected to: $output"
Linux — Evidence Collection
bash
#!/bin/bashOUTPUT"/tmp/ir_$(hostname)_$(date +%Y%m%d_%H%M%S)"mkdir -p "$OUTPUT"# Processus et connexionsps 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éswho > "$OUTPUT/who.txt"last -n 100 > "$OUTPUT/last.txt"lastb -n 100 > "$OUTPUT/lastb.txt" 2>/dev/null# Logs authcp /var/log/auth.log "$OUTPUT/" 2>/dev/nullcp /var/log/secure "$OUTPUT/" 2>/dev/nulljournalctl --since "24 hours ago" > "$OUTPUT/journal_24h.txt"# Tâches planifiéescrontab -l > "$OUTPUT/crontab_root.txt" 2>/dev/nullls -la /etc/cron > "$OUTPUT/cron_dirs.txt"cat /etc/crontab > "$OUTPUT/etc_crontab.txt"# Persistancesystemctl list-units --type=service --state=running > "$OUTPUT/services.txt"ls -la /etc/systemd/system/ > "$OUTPUT/systemd_units.txt"# Hash des process actifsfor pid in ls /proc | grep -E '^[0-9]+$'; doexereadlink /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
Variables
{{DEFENDER_TOKEN}}
{{MACHINE_ID}}
# Windows Defender — Isolation via PowerShellAdd-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
Variables
{{C2_IP}}
# Linux iptables — bloquer IP C2iptables -I OUTPUT -d {{C2_IP}} -j DROPiptables -I INPUT -s {{C2_IP}} -j DROPiptables-save > /etc/iptables/rules.v4# Windows — règle firewallnetsh advfirewall firewall add rule name"IR-Block-C2"dirout actionblock remoteip{{C2_IP}}# Palo Alto via CLIset security policy rules ir-block-c2 destination {{C2_IP}}/32 action deny
Active Directory — Compte compromis
powershell
Variables
{{COMPROMISED_USER}}
{{NEW_RANDOM_PASS}}
# Désactiver immédiatement le compte compromisDisable-ADAccount -Identity "{{COMPROMISED_USER}}"# Réinitialiser le mot de passeSet-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-KeyVersionNumberSet-ADUser $user -Replace @{'msDS-KeyVersionNumber' = 1}# Retirer des groupes privilégiésRemove-ADGroupMember -Identity "Domain Admins" -Members "{{COMPROMISED_USER}}" -Confirm:$false
Template communication P1
Variables
{{INCIDENT_TYPE}}
{{DATE}}
{{HEURE}}
{{YYYYMMDD}}
{{NNN}}
{{ANALYST_NAME}}
{{COUNT}}
{{HOSTNAMES}}
{{USERNAMES}}
{{HOST}}
{{USER}}
{{SOC_PHONE}}
{{SOC_SLACK_CHANNEL}}
OBJET P1 INCIDENT {{INCIDENT_TYPE}} {{DATE}} {{HEURE}} UTCINCIDENT EN COURS SEVERITY P1Incident ID IR{{YYYYMMDD}}{{NNN}}Dtect le {{DATE}} {{HEURE}} UTCAnalyste {{ANALYST_NAME}}Statut CONTAINMENT IN PROGRESSRSUMDescription en 3-5 phrases quoi qui impact mtier estimSCOPE CONFIRMHtes affects {{COUNT}} {{HOSTNAMES}}Utilisateurs compromis {{COUNT}} {{USERNAMES}}Donnes potentiellement exposes OUI/NON/EN COURS DVALUATIONACTIONS EN COURSHHMM Isolation de {{HOST}} initieHHMM Compte {{USER}} dsactivHHMM Analyse forensique en coursHHMM Recherche de propagation latralePROCHAINE MISE JOUR dans 30 minutes ou changement de statutContact SOC {{SOC_PHONE}} | {{SOC_SLACK_CHANNEL}}
Template post-incident (J+7)
markdown
Variables
{{ID}}
{{T0}}
{{T1}}
{{T2}}
{{T3}}
{{LEVEL}}
{{T4}}
{{T5}}
{{T6}}
{{T7}}
{{DURATION}}
{{LIST}}
{{ACTION}}
{{TEAM}}
{{DATE}}
# 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.
OPS·BRAIN v1.090 notes · Securitylocal