BreizhCTF 2023 - Rapport d'audit
Table of Contents
BreizhCTF 2023 - This article is part of a series.
Enoncé #
Lâentreprise Cybeur-salĂ© a transmis au BreizhCTF un rapport dâaudit concernant son infrastructure. Suite a un incident chez Cybeur-salĂ©, lâarchive a fuitĂ© sur le cĂ©lĂšbre site Braidzh-Forum. LâESN affirme cependant que la confidentialitĂ© du rapport reste garantie, puisque lâarchive est protĂ©gĂ©e par un mot de passe fort. Dans la continuitĂ© de lâincident, vous avez Ă©tĂ© mandatĂ© par le BreizhCTF pour confirmer de maniĂšre impartiale les dires de Cybeur-salĂ©.
Auteur: Zeecka
Fichiers #
- Rapport_Audit_BreizhCTF.zip (md5sum: c1903432eb7532d82c7f5a3c4e80a04c)
Solution #
Le challenge fournit une archive ZIP chiffrée, on retrouve dedans 3 fichiers :
20211216_OWASP-MSP_OWASP_Top_Ten_2021.pdf
Rapport_Audit_BreizhCTF.docx
cvss-v31-specification_r1.pdf
Le fichier d’intĂ©rĂȘt pour le challenge est Rapport_Audit_BreizhCTF.docx
. Les deux autres fichiers sont des fichiers publics et accessible, on peut donc rĂ©aliser une attaque par clair connu sur l’archive ZIP.
Pour vĂ©rifier si cette attaque est possible, il faut vĂ©rifier le type de chiffrement de l’archive ZIP, celui ci doit ĂȘtre ZipCrypto sans quoi l’attaque ne sera pas forcĂ©ment possible.
Pour vérifier ces informations on peut utiliser la commande 7z l
et
[user@work ~]$ 7z l /tmp/Rapport_Audit_BreizhCTF.zip
--
Path = /tmp/Rapport_Audit_BreizhCTF.zip
Type = zip
Physical Size = 1357917
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2022-11-28 15:09:11 ..... 430627 430639 20211216_OWASP-MSP_OWASP_Top_Ten_2021.pdf
2022-11-28 15:05:39 ..... 688733 688745 cvss-v31-specification_r1.pdf
2022-11-28 15:08:14 ..... 237871 237883 Rapport_Audit_BreizhCTF.docx
------------------- ----- ------------ ------------ ------------------------
2022-11-28 15:09:11 1357231 1357267 3 files
On retrouve bien nos trois fichiers.
[user@personal-standalone ~]$ 7z l -slt /tmp/Rapport_Audit_BreizhCTF.zip
--
Path = /tmp/Rapport_Audit_BreizhCTF.zip
Type = zip
Physical Size = 1357917
----------
Path = 20211216_OWASP-MSP_OWASP_Top_Ten_2021.pdf
Folder = -
Size = 430627
Packed Size = 430639
Modified = 2022-11-28 15:09:11
Created =
Accessed =
Attributes = _ -rw-r--r--
Encrypted = +
Comment =
CRC = 435B5F61
Method = ZipCrypto Store
Host OS = Unix
Version = 10
Volume Index = 0
Path = cvss-v31-specification_r1.pdf
Folder = -
Size = 688733
Packed Size = 688745
Modified = 2022-11-28 15:05:39
Created =
Accessed =
Attributes = _ -rw-r--r--
Encrypted = +
Comment =
CRC = B239DAF7
Method = ZipCrypto Store
Host OS = Unix
Version = 10
Volume Index = 0
Path = Rapport_Audit_BreizhCTF.docx
Folder = -
Size = 237871
Packed Size = 237883
Modified = 2022-11-28 15:08:14
Created =
Accessed =
Attributes = _ -rw-r--r--
Encrypted = +
Comment =
CRC = 3023FA81
Method = ZipCrypto Store
Host OS = Unix
Version = 10
Volume Index = 0
La méthode de chiffrement utilisées pour nos trois fichiers est bien ZipCrypto Store
.
Maintenant ces informations confirmĂ©e, il ne reste qu’Ă rĂ©cupĂ©rer un des fichiers pour pouvoir rĂ©aliser l’attaque par clair connu, ici j’ai choisi de tĂ©lĂ©charger 20211216_OWASP-MSP_OWASP_Top_Ten_2021.pdf
car facilement trouvable en ligne.
Enfin, on peut rĂ©aliser l’attaque par clair connu, pour cela on peut utiliser l’outil bkcrack.
bkcrack -C Rapport_Audit_BreizhCTF.zip -c 20211216_OWASP-MSP_OWASP_Top_Ten_2021.pdf -P Rapport_Audit_BreizhCTF.zip -p 20211216_OWASP-MSP_OWASP_Top_Ten_2021.pdf -e
bkcrack 1.5.0 - 2022-09-25
[21:15:45] Z reduction using 688726 bytes of known plaintext
0.7 % (4952 / 688726)
[21:15:46] Attack on 166 Z values at index 684443
Keys: 2cec9bbe 8410cf1b 74078a50
100.0 % (166 / 166)
[21:15:46] Keys
2cec9bbe 8410cf1b 74078a50
Maintenant que les clĂ©s sont extraites, on peut extraire le Rapport d’audit chiffrĂ©.
bkcrack -C Rapport_Audit_BreizhCTF.zip -c Rapport_Audit_BreizhCTF.docx -k 2cec9bbe 8410cf1b 74078a50 -d Rapport_Audit_BreizhCTF.docx
N’ayant pas libreoffice ni Word sous la main pour ouvrir le fichier .docx
j’ai personnellement extrait le flag du fichier en le dĂ©zippant et en accĂ©dant au fichier /word/document.xml
.
[...]
<w:p w:rsidR="12C86AB6" w:rsidP="12C86AB6" w:rsidRDefault="12C86AB6"
w14:paraId="6EC48FF3" w14:textId="72517AB1">
<w:pPr>
<w:pStyle w:val="Normal" />
<w:spacing w:line="480" w:lineRule="auto" />
</w:pPr>
<w:r w:rsidR="12C86AB6">
<w:rPr />
<w:t>BZHCTF{</w:t>
</w:r>
<w:proofErr w:type="spellStart" />
<w:r w:rsidR="12C86AB6">
<w:rPr />
<w:t>CryptoKnownFiles</w:t>
</w:r>
<w:proofErr w:type="spellEnd" />
<w:r w:rsidR="12C86AB6">
<w:rPr />
<w:t>!}</w:t>
</w:r>
</w:p>
[...]
Flag #
BZHCTF{CryptoKnownFiles!}