Sexy Pandalog

Osu, Tatakae, Sexy Pandas blog

 

June 9, 2008

Reversing 500 writeup!

Filed under: Blogroll, CTF, prequals, writeups — at 22:39
1.- Introduction.
At quals  we hardly had time  to analyse rev500.  However, what we saw  was very
appealing : interesting code obfuscation, use of fpu and random numbers, and the
string "./MathIsHard" suggested  that the algorithm could be  interesting. So we
decided to give it another try with more time.

A brief initial analysis doesn't bring a lot of information : The binary is a 32
bit ELF for FreeBSD  that listens for connections on port  2600. When we connect
to it we receive 5 dwords containing integers, all of them below 1000.

$ readelf -a ./rev ELF Header: ... Class: ELF32 OS/ABI: UNIX - FreeBSD ABI Version: 0 Type: EXEC (Executable file) Machine: Intel 80386 ... Relocation section '.rel.plt' at offset 0x808 contains 43 entries: Offset Info Type Sym.Value Sym. Name 0804e0d4 00000507 R_386_JUMP_SLOT 00000000 random   0804e0d8 00000607 R_386_JUMP_SLOT 00000000 recv 0804e0f4 00000e07 R_386_JUMP_SLOT 00000000 socket 0804e0f8 00000f07 R_386_JUMP_SLOT 00000000 send 0804e0fc 00001107 R_386_JUMP_SLOT 00000000 accept 0804e108 00001507 R_386_JUMP_SLOT 00000000 bind ...

(more…)

 

Reversing500

Filed under: CTF, Defcon, prequals — at 12:42

Pandas With Gambas reversing monkeys are glad to introduce…
Reversing 500 CTF Prequals solution!

#!/usr/bin/python
import struct
import socket
import math

def makeSin( freq, number_samples, samples_per_seq ) :
    data = ''
    for i in range(0,number_samples):
        data += struct.pack('h', 1000*math.sin( 2*freq*i*math.pi/samples_per_seq ))
    return data

# print '''Rev 500'''

Host = '127.0.0.1'
Port = 2600

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((Host, Port))
chunk = s.recv(4*5)

print struct.unpack_from('LLLLL', chunk)

if chunk == '':
    print 'Error receiving data\n'

number_samples  = 5000
samples_per_sec = 4000

header_fmt  = struct.pack('L', 0x20746d66 )   # fmt
header_fmt += struct.pack('L', 16 )           # size   = 16
header_fmt += struct.pack('h', 1  )           # format = pcm
header_fmt += struct.pack('h', 1  )           # n. Chanels. unused
header_fmt += struct.pack('L', samples_per_sec )
header_fmt += struct.pack('L', 1  )           # Avg. Bytes Sec. unused
header_fmt += struct.pack('h', 2  )           # block align. Bytes/sample*channel
header_fmt += struct.pack('h', 16 )           # bits_per_sample

size_header_data = number_samples * 2
frequencies = struct.unpack_from('LLLLL', chunk)
header_data  = struct.pack('L', 0x61746164       )
header_data += struct.pack('L', size_header_data )
header_data += makeSin( frequencies[0], number_samples/5, samples_per_sec)
header_data += makeSin( frequencies[1], number_samples/5, samples_per_sec)
header_data += makeSin( frequencies[2], number_samples/5, samples_per_sec)
header_data += makeSin( frequencies[3], number_samples/5, samples_per_sec)
header_data += makeSin( frequencies[4], number_samples/5, samples_per_sec)

size = len(header_fmt) + len(header_data) + 4

header  = struct.pack('<L', 0x46464952 )  # RIFF
header += struct.pack('<L', size )        # size
header += struct.pack('<L', 0x45564157 )  # WAVE

s.send( header)
s.send( header_fmt)
s.send( header_data )

file = header + header_fmt + header_data
print s.recv(1024)

Stay tuned for the write-up….

 

June 2, 2008

We’re baaack!!

Filed under: CTF — at 03:49

Pues sí, tal y como es posible consultar en los resultados oficiales de Kenshoto, lo hemos vuelto a conseguir. Por segundo año consecutivo estaremos en la final del CTF de la Defcon, intentando el asalto al título. Este año las prequals han estado muy igualadas, y el nivel de las pruebas ha sido realmente desesperante. Tanto es así que ha habido hasta 5 pruebas que nadie ha podido superar (4 de ellas ni siquiera se llegaron a activar).

En cuanto al equipo, este año bajo el nombre de “Pandas with Gambas” hemos podido conseguir un trabajado segundo puesto (empatados con los primeros). Así que a todos aquellos que durante este largo fin de semana nos habeis mostrado vuestro apoyo sólo nos cabe decir: MUCHAS GRACIAS.

Ahora es tiempo de celebrarlo y preparar el que, seguro, será uno de los CTF más complejos y disputados que hayamos visto. Esperemos que la suerte esté de nuestro lado.

Valid XHTML 1.0 Valid CSS 2