RogueOne - Analyse d'Incident C2 via Dump Mémoire
Contexte du Scénario
Un analyste SOC a détecté un processus suspect sur une workstation Windows. Un dump mémoire a été capturé pour analyser l'incident. L'investigation révèle une communication avec un serveur Command & Control (C2). L'objectif est d'identifier le processus malveillant, le canal C2 et la chronologie de l'attaque.
Outils et Méthodologie
- Volatility 3 : Framework moderne d'analyse de dump mémoire
- VirusTotal : Plateforme d'analyse de malware
- Analyse de processus : Identification de comportements suspects
Informations Système
Analyse Initiale
┌──(.venv)(alesio㉿Alesio)-[~/RogueOne/volatility3]
└─$ python ./vol.py -f ../20230810.mem windows.info.Info
Volatility 3 Framework 2.7.0
[...]
Variable Value
Kernel Base 0xf80178400000
DTB 0x16a000
Is64Bit True
IsPAE False
layer_name 0 WindowsIntel32e
memory_layer 1 FileLayer
NtSystemRoot C:\WINDOWS
NtMajorVersion 10
NtMinorVersion 0
PE MajorOperatingSystemVersion 10
PE MinorOperatingSystemVersion 0
SystemTime 2023-08-10 11:32:00
Système : Windows 10 Date de capture : 2023-08-10 11:32:00
Analyse Réseau - Identification du C2
Question 1 : Connexions Suspectes
┌──(.venv)(alesio㉿Alesio)-[~/RogueOne/volatility3]
└─$ python ./vol.py -f ../20230810.mem windows.netstat.NetStat
[...]
Offset Proto LocalAddr LocalPort ForeignAddr ForeignPort State PID Owner Created
0x9e8b8cb58010 TCPv4 172.17.79.131 64254 13.127.155.166 8888 ESTABLISHED 6812 svchost.exe 2023-08-10 11:30:03.000000
0x9e8b9045f8a0 TCPv4 172.17.79.131 63823 20.198.119.84 443 ESTABLISHED 3404 svchost.exe 2023-08-10 11:14:21.000000
0x9e8b90fe82a0 TCPv4 172.17.79.131 64263 20.54.24.148 443 ESTABLISHED 6136 svchost.exe 2023-08-10 11:31:18.000000
[...]
Connexions suspectes identifiées :
- PID 6812 : Connexion vers
13.127.155.166:8888(port non standard) - PID 3404 : Connexion HTTPS légitime
- PID 6136 : Connexion HTTPS légitime
Analyse des Processus
┌──(.venv)(alesio㉿Alesio)-[~/RogueOne/volatility3]
└─$ python ./vol.py -f ../20230810.mem windows.pslist.PsList | grep -E "6136|6812|3404"
3404 788 svchost.exe 0x9e8b8a562080 7 - 0 False 2023-08-10 11:13:44.000000 N/A Disabled
6136 788 svchost.exe 0x9e8b8b34a080 11 - 0 False 2023-08-10 11:13:53.000000 N/A Disabled
6812 7436 svchost.exe 0x9e8b87762080 3 - 1 False 2023-08-10 11:30:03.000000 N/A Disabled
4364 6812 cmd.exe 0x9e8b8b6ef080 1 - 1 False 2023-08-10 11:30:57.000000 N/A Disabled
Analyse :
- PID 6812 : Parent = 7436 (explorer.exe) - SUSPECT
- PID 6812 a un processus enfant : cmd.exe (PID 4364) - TRÈS SUSPECT
- PID 3404 et 6136 : Parent = 788 (services.exe) - Légitime
┌──(.venv)(alesio㉿Alesio)-[~/RogueOne/volatility3]
└─$ python ./vol.py -f ../20230810.mem windows.pslist.PsList | grep -E "7436|788"
788 656 services.exe 0x9e8b8949e080 10 - 0 False 2023-08-10 11:13:42.000000
7436 7400 explorer.exe 0x9e8b8c4d2080 75 - 1 False 2023-08-10 11:14:07.000000
Conclusion : Le processus svchost.exe (PID 6812) lancé depuis explorer.exe est malveillant car :
- Les processus svchost.exe légitimes sont lancés par
services.exe - Il communique sur un port non standard (8888)
- Il a spawné un processus
cmd.exe
Question 1 : PID du Processus Malveillant
Q: Please identify the malicious process and confirm process id of malicious process.
R: 6812
Question 2 : Processus Enfant
Q: The SOC team believe the malicious process may spawned another process which enabled threat actor to execute commands. What is the process ID of that child process?
R: 4364 (cmd.exe)
Analyse du Malware
Question 3 : Hash MD5 du Malware
Extraction du processus malveillant :
┌──(.venv)(alesio㉿Alesio)-[~/RogueOne/volatility3]
└─$ python ./vol.py -f ../20230810.mem windows.dumpfile --pid 6812
[...]
ImageSectionObject 0x9e8b91ec0140 svchost.exe file.0x9e8b91ec0140.0x9e8b957f24c0.ImageSectionObject.svchost.exe.img
[...]
┌──(.venv)(alesio㉿Alesio)-[~/RogueOne/volatility3]
└─$ md5sum file.0x9e8b91ec0140.0x9e8b957f24c0.ImageSectionObject.svchost.exe.img
5bd547c6f5bfc4858fe62c8867acfbb5 file.0x9e8b91ec0140.0x9e8b957f24c0.ImageSectionObject.svchost.exe.img
R: 5bd547c6f5bfc4858fe62c8867acfbb5
Informations C2
Question 4 : Serveur C2 et Port
D'après l'analyse réseau précédente :
Q: In order to find the scope of the incident, the SOC manager has deployed a threat hunting team to sweep across the environment for any indicator of compromise. It would be a great help to the team if you are able to confirm the C2 IP address and ports so our team can utilise these in their sweep.
R: 13.127.155.166:8888
Chronologie de l'Attaque
Question 5 : Timeline
D'après l'analyse du processus :
6812 7436 svchost.exe 0x9e8b87762080 3 - 1 False 2023-08-10 11:30:03.000000
Q: We need a timeline to help us scope out the incident and help the wider DFIR team to perform root cause analysis. Can you confirm time the process was executed and C2 channel was established?
R: 10/08/2023 11:30:03
Question 6 : Offset Mémoire
Q: What is the memory offset of the malicious process?
R: 0x9e8b87762080
Analyse VirusTotal
Question 7 : Première Soumission
Analyse sur VirusTotal:
Dans la section "Details", on trouve :
- First Submission :
2023-08-10 11:58:10
Q: You successfully analyzed a memory dump and received praise from your manager. The following day, your manager requests an update on the malicious file. You check VirusTotal and find that the file has already been uploaded, likely by the reverse engineering team. Your task is to determine when the sample was first submitted to VirusTotal.
R: 10/08/2023 11:58:10
Indicateurs de Compromission (IoC)
Processus Malveillant
- Nom : svchost.exe (usurpation d'identité)
- PID : 6812
- PPID : 7436 (explorer.exe) - Anormal
- Hash MD5 : 5bd547c6f5bfc4858fe62c8867acfbb5
- Offset mémoire : 0x9e8b87762080
- Heure d'exécution : 2023-08-10 11:30:03
Serveur Command & Control
- IP : 13.127.155.166
- Port : 8888
- Protocole : TCP
- Connexion établie : 2023-08-10 11:30:03
Processus Enfant
- Nom : cmd.exe
- PID : 4364
- PPID : 6812
- Heure de création : 2023-08-10 11:30:57
Chaîne d'Attaque (Kill Chain)
- Initial Access : Mécanisme inconnu (probablement phishing ou exploit)
- Execution : Lancement de svchost.exe malveillant (2023-08-10 11:30:03)
- Command & Control : Connexion vers 13.127.155.166:8888
- Persistence : Utilisation du nom svchost.exe pour se fondre dans le système
- Execution : Spawn de cmd.exe pour exécuter des commandes (11:30:57)
Recommandations de Remédiation
Actions Immédiates
- Isolation : Déconnecter la machine du réseau
- Blocage C2 : Bloquer l'IP 13.127.155.166 au niveau du firewall
- Kill Process : Terminer les PID 6812 et 4364
- Scan Complet : Effectuer un scan antivirus complet
Actions à Court Terme
- Analyse Approfondie : Reverse engineering du malware
- Hunt Threat : Rechercher le hash MD5 sur tous les endpoints
- Vérifier Persistence : Chercher dans Run keys, services, scheduled tasks
- Logs Review : Analyser les logs pour identifier le vecteur d'infection initial
Actions à Long Terme
- EDR Deployment : Déployer une solution EDR
- Network Monitoring : Surveillance accrue du trafic réseau
- User Training : Formation sur le phishing et les malwares
- Patch Management : S'assurer que tous les systèmes sont à jour
Résumé
Ce challenge Sherlock nous a permis de :
Compétences Développées
- Analyse de dump mémoire avec Volatility 3
- Identification de processus malveillants par analyse de parenté
- Analyse de connexions réseau pour identifier des C2
- Timeline reconstruction pour la réponse à incident
- Utilisation de VirusTotal pour l'analyse de malware
- Identification d'IoC pour le threat hunting
Points Clés à Retenir
- Processus svchost.exe légitimes doivent toujours être lancés par
services.exe - Ports non standards (8888) sont souvent utilisés par des C2
- L'analyse de parenté des processus est cruciale pour identifier les anomalies
- Les attaquants utilisent des noms légitimes (svchost.exe) pour se camoufler
- La corrélation temps/réseau/processus permet de reconstituer une attaque
- VirusTotal peut fournir des informations sur la chronologie d'une campagne
Différences avec les Processus Légitimes
| Caractéristique | Légitime | Malveillant (ce cas) |
|---|---|---|
| Processus Parent | services.exe (PID 788) | explorer.exe (PID 7436) |
| Emplacement | C:\Windows\System32\ | Probablement autre |
| Arguments | Multiples paramètres | Peu/pas d'arguments |
| Connexions réseau | Services Microsoft | IP étrangère, port 8888 |
| Comportement | Stable | Spawn cmd.exe |
Outils Utilisés
- Volatility 3 : windows.info, windows.netstat, windows.pslist, windows.dumpfiles
- md5sum : Calcul de hash
- VirusTotal : Analyse de malware et timeline
- grep : Filtrage de résultats
Ce Sherlock démontre l'importance d'une analyse méthodique et de la corrélation de plusieurs sources de données (processus, réseau, timeline) pour identifier et comprendre une intrusion.