I recently uncovered a stack based buffer overflow in winamp
version 2.10 which lets me execute 'arbitrary code'. It is
carried out through .pls files which winamp uses for playlists.
This is unnerving as it is a feasible plan to trade playlists on
irc during a mp3 trading session with someone.
The overflow occurs when an entry greater than 580 bytes is
read in from a .pls file. The EIP is the only register overwritten
in the next four bytes that follow, from there on is space for
your shell code. eg.
The first 580 bytes get mangled around in memory but the 585
byte (where our shell code starts) is pointed to by the ESP,
therefore a simple 'JMP ESP' or the like will land us back in
our shell code. I used a 'JMP ESP' at address 0xBFB9CFF7 in
comctl32.dll which winamp loads. Pointing our EIP into that
address lands us back where we want to be.
This was all created/tested on Windows 98 [Version 4.10.1998]
running on an Intel PII400 with 128MB RAM.
The Shell Code:
The shell code I wrote for this simply displays a message box
and then calls exit(). However Winamp doesn't load msvcrt.dll
which is needed to call exit() so we have to load it ourselves.
I used the address 0xBFF776D4 in kernel32.dll (v4.10.1998) for
LoadLibraryA(). For calling Messagebox I used the address
0xBFF5412E in user32.dll (v4.10.1998) and for calling exit() I
used the address 0x78005504 in msvcrt.dll (v6.00.8397.0). It
didn't warrant using GetProcAddress for compatibilities sake.
For the OP codes see the exploit further on.
/* Stack based buffer overflow exploit for Winamp v2.10
* Author Steve Fewer, 04-01-2k. Mail me at darkplan@oceanfree.net
*
* For a detailed description on the exploit see my advisory.
*
* Tested with Winamp v2.10 using Windows98 on an Intel
* PII 400 with 128MB RAM
*
* http://indigo.ie/~lmf */