Saturday, July 12, 2014

Pwnium CTF2014: re150 Kernel Land

Dalam soal kali ini, kita diberikan sebuah file ELF yang memenuhi multiboot specification (file ELF ini adalah kernel yang bisa diboot dengan grub atau qemu). Tapi karena ada petunjuk bahwa di tick ke 3 kita akan menemukan flagnya (“The third Tick gives you the answer ;)”), saya tidak memboot file ini, tapi hanya melihat disassemblynya saja pada fungsi “timer_tick”.

00100958 <timer_tick>:
100958: 83 ec 14 sub $0x14,%esp
10095b: a1 c0 60 10 00 mov 0x1060c0,%eax
100960: 8d 50 01 lea 0x1(%eax),%edx
100963: 89 15 c0 60 10 00 mov %edx,0x1060c0
100969: 50 push %eax
10096a: 68 03 22 10 00 push $0x102203
10096f: e8 d5 05 00 00 call 100f49 <printf>
100974: 0f b6 0d c0 60 10 00 movzbl 0x1060c0,%ecx
10097b: 83 c4 10 add $0x10,%esp
10097e: b8 00 00 00 00 mov $0x0,%eax
100983: 89 ca mov %ecx,%edx
100985: 32 90 60 30 10 00 xor 0x103060(%eax),%dl
10098b: 83 c2 01 add $0x1,%edx
10098e: 88 90 60 30 10 00 mov %dl,0x103060(%eax)
100994: 83 c0 01 add $0x1,%eax
100997: 83 f8 28 cmp $0x28,%eax
10099a: 75 e7 jne 100983 <timer_tick+0x2b>
10099c: 83 c4 0c add $0xc,%esp
10099f: c3 ret

Data ada di 0x103060 dan ada 0x28 byte (40 bytes).

$ objdump -s --start-address=0x103060 --stop=0x103088 kernel


kernel:     file format elf32-i386 

Contents of section .data:
103060 49746f66 726a7862 32602e2e 632e322e Itofrjxb2`..c.2.
103070 36303331 5d673662 31676730 5e296231 6031]g6b1gg0^)b1
103080 3163625e 5e2d5d7a 1cb^^-]z

Saya terjemahkan langsung algoritmanya apa adanya ke C:

Ketika dijalankan didapatkan:

cl = 1 flag = Ivohtlzd4b00c0408231]g8d1gg2`)d11cd``-]|
cl = 2 flag = Lunkwoyg7a33b373;124`f;g4ff1c,g44bgcc0`
cl = 3 flag = Pwnium{e5c11b1519328df9e8ff3a0e88beaa4d}

di “tick” ke 3 itu kita mendapatkan flagnya:


Pwnium{e5c11b1519328df9e8ff3a0e88beaa4d}

No comments:

Post a Comment