Cyberdefenders - DetectLog4j

DetectLog4j
Info
- Category : Digital Forensics
- SHA1SUM : 6556e7d46e89bf2ea68e05cf101920e2de071a22
- Published : Jan. 15, 2022
- Author : CyberDefenders
- Size : 2.8 GB
- Tags : Windows Disk ransomware log4shell
Uncompress the challenge (pass: cyberdefenders.org)
Scenario
For the last week, log4shell vulnerability has been gaining much attention not for its ability to execute arbitrary commands on the vulnerable system but for the wide range of products that depend on the log4j library. Many of them are not known till now. We created a challenge to test your ability to detect, analyze, mitigate and patch products vulnerable to log4shell.
Tools
- Arsenal Image Mounter
- RegistryExplorer
- RegRipper
- EventLog Explorer
- dnspy
- CyberChef
- fakenet
- VirusTotal
- IPLookUp
Questions
1 - What is the computer hostname?
Avec avec AccessData FTK Imager, ouvrir le disque et aller à ROOT > System32 > config
et exporter la ruche SYSTEM. Avec Registry Explorer importer la ruche et regarder ROOT > ControleSet > Control > ComputerName
.
Réponse : VCW65
2 - What is the Timezone of the compromised machine?
Avec Registry Explorer : ROOT > SYSTEM > ControleSet > Control > TimeZoneInformation
TimeZoneKeyName : Pacific Standar Time
correspont à UTC-8
Réponse : UTC-8
3 - What is the current build number on the system?
Avec Registry Explorer : ROOT > SOFTWARE > Microsoft > Windows NT > CurrentVersion > CurrentBuild
: 14393
Réponse : 14393
4 - What is the computer IP?
Avec Registry Explorer : ROOT > SYSTEM > ControlSet > Services > Tcpip > Parameters > Interfaces > <interface> > NameServer
Réponse : 192.168.112.139
5 - What is the domain computer was assigned to?
Avec Registry Explorer : ROOT > SYSTEM > ControlSet > Services > Tcpip > Parameters > DNSRegisteredAdapters > <adapter> > PrimaryDomainName
Réponse : cyberdefenders.org
6 - When was myoussef user created?
Avec AccessData FTK Imager exporter Security Logs : ROOT > windows > system32 > winevt > Logs
Dans l’event viewer : EventId 4720 & recherche : myoussef
Réponse : 2021-12-28 06:57:23 UTC
7 - What is the user mhasan password hint?
Avec AccessData FTK Imager, ouvrir le disque et aller à ROOT > System32 > config
et exporter la ruche SAM. Avec Registry Explorer importer la ruche et regarder ROOT > SAM > > Domains > Account > Users > mhasan
.
On regarde le last write timestamp
du user mhasan. O, compare avec les autres ruches avec des noms moins intuitif ROOT > SAM > Domains > Account > Users > 00000404 > UserPasswordHint
: https://www.linkedin.com/in/0xmohamedhasan/
Réponse : https://www.linkedin.com/in/0xmohamedhasan/
8 - What is the version of the VMware product installed on the machine?
Avec Registry Explorer : ROOT > SOFTWARE > VMware, Inc. > vCenter Server > ProductVersion
: 6.7.0.40322
Réponse : 6.7.0.40322
9 - What is the version of the log4j library used by the installed VMware product?
Avec AccessData FTK Imager, ouvrir le disque et aller à ROOT > Program Files > VMware > vCenter Server > VMware Identity Services
: log4j-core-2.11.2.jar
Note : Chercher l’endroit ou l’application stocke ses fichier .jar
Réponse : 2.11.2
10 - What is the log4j library log level specified in the configuration file?
Avec AccessData FTK Imager, ouvrir le disque et aller à ROOT > Program Files > VMware > vCenter Server > VMware Identity Services
: log4j2.xml
Regarder les balises contenant la value level
Réponse : INFO
11 - The attacker exploited log4shell through an HTTP login request. What is the HTTP header used to inject payload?
Recherche Google : “exploit log4j vcenter”
Réponse : X-Forwarded-For
12 - The attacker used the log4shell.huntress.com payload to detect if vcenter instance is vulnerable. What is the first link of the log4huntress payload?
Note : log4shell.huntress.com est un tester de vulnérabilité de log4j
On connait la version du vCenter (6.7), recherche Google “log4j exploit vcenter” –> “Workaround instrcution…”
Modification du Security Token Service (STS)
Rechercher dans les logs STS, avec avec AccessData FTK Imager, ouvrir le disque et aller à ROOT > ProgramData > VMware > vCenter Server > runtime > VMwareSTSService > logs
: audit_events.log
Réponse : log4shell.huntress.com:1389/b1292f3c-a652-4240-8fb4-59c43141f55a
13 - When was the first successful login to vsphere WebClient?
On regarde dans le fichier audit_events.log et on cherche un LoginSuccess
Réponse : 2021-12-28 20:39:29 UTC
14 - What is the attacker’s IP address?
On regarde dans le fichier audit_events.log
Réponse : 192.168.112.128
15 - What is the port the attacker used to receive the cobalt strike reverse shell?
Avec avec AccessData FTK Imager exporter les logs Microsoft-Windows-Powershell/Operational & Admin : ROOT > windows > system32 > winevt > Logs
EventID : 4104 | Exécuter une commande distante
|
|
CyberChef –> Frombase64 > Gunzip
On obtient un script.ps1. On met se script dans une sandbox online. Détails réseaux –> 192.168.112.128:1337
Réponse : 1337
16 - What is the script name published by VMware to mitigate log4shell vulnerability?
Documentation VMware
Réponse : vc_log4j_mitigator.py
17 - In some cases, you may not be able to update the products used in your network. What is the system property needed to set to ’true’ to work around the log4shell vulnerability?
Documentation VMware ou Microsoft
Réponse : log4j.formatMsgNoLookups
18 - What is the log4j version which contains a patch to CVE-2021-44228?
Réponse : 2.15.0
19 - Removing JNDIlookup.class may help in mitigating log4shell. What is the sha256 hash of the JNDILookup.class?
Avec avec AccessData FTK Imager, ouvrir le disque et extraire le jar ROOT > Program Files > VMware > vCenter Server > VMware Identity Services
: log4j-core-2.11.2.jar
Rename log4j-core-2.11.2.jar –> log4j-core-2.11.2.zip
Path : log4j-core-2.11.2.zip\org\apache\logging\log4j\core\lookup
Réponse : 0F038A1E0AA0AFF76D66D1440C88A2B35A3D023AD8B2E3BAC8E25A3208499F7E
20 - Analyze JNDILookup.class. What is the value stored in the CONTAINER_JNDI_RESOURCE_PATH_PREFIX variable?
Installer jd-gui (decompiler java), décompiler le jar.
org.apache.logging.log4j.core/lookup/JndiLookup.class
|
|
Réponse : java:comp/env/
21 - What is the executable used by the attacker to gain persistence?
Avec avec AccessData FTK Imager, ouvrir le disque et extraire le fichier NTUSER.DAT
de Administrator.WIN-B633EO9K91M
Avec Registry Explorer : ROOT > SOFTWARE > Microsoft > Windows > CurrentVersion > RunOnce
Réponse : C:\Users\Adiminstrator\Desktop\baaaackdooor.exe
22 - When was the first submission of ransomware to virustotal?
Après quelques recherches, note la présence d’un exe à la racine du disk C:\
, le fichier khonsari.exe. On le met dans VT
Réponse : 2021-12-11 22:57:01
23 - The ransomware downloads a text file from an external server. What is the key used to decrypt the URL?
On peut reverse le malware avec dnspy, aller au point d’entré. On voit la méthode webClient.DownloadString()
. Dans celle-ci des opérations de XOR sont réalisés, on peut en déduire que la variable string text = URL_cipher
et string text3 = key
. On peut confirmer en mettant un breakpoint sur le return de webClient.DownloadString()
|
|
URL : http://3.145.115.94/zambos_caldo_de_p.txt
Réponse : GoaahQrC
24 - What is the ISP that owns that IP that serves the text file?
2 possibilités :
- On a l’IP donc on peut faire un IP lookup sur 3.145.115.94
- Upload le malware dans VT ou dans une sandbox online et voir les connexions effectués par le malware
Réponse : Amazon
25 - The ransomware check for extensions to exclude them from the encryption process. What is the second extension the ransomware checks for?
On connait la famille de malware, 2 options :
- chercher de la dcumentation sur l’exe
- reverse l’exe puis cyberchef
Unescape string > XOR
|
|
g\u001d/. + Unescape string > XOR par ItAGEocK = .ini
Réponse : ini