[TKADV2008-014] MPlayer TwinVQ Processing Stack Buffer Overflow Vulnerability Dec 14 2008 04:32PM
Tobias Klein (tk trapkit de)
Please find attached a detailed advisory of the vulnerability.

Alternatively, the advisory can also be found at:
Hash: SHA1

Advisory: MPlayer TwinVQ Processing Stack Buffer Overflow
Advisory ID: TKADV2008-014
Revision: 1.0
Release Date: 2008/12/14
Last Modified: 2008/12/14
Date Reported: 2008/12/07
Author: Tobias Klein (tk at trapkit.de)
Affected Software: MPlayer 1.0rc2 < r28150 and
MPlayer SVN trunk < r28149
Remotely Exploitable: Yes
Locally Exploitable: No
Vendor URL: http://www.mplayerhq.hu
Vendor Status: Vendor has released an updated version
Patch development time: 8 days

Vulnerability Details:

MPlayer contains a stack buffer overflow vulnerability while parsing
malformed TwinVQ media files. The vulnerability may be exploited by a
(remote) attacker to execute arbitrary code in the context of MPlayer.

Technical Details:

Source code file: libmpdemux\demux_vqf.c

24 static demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
49 char chunk_id[4];
50 unsigned chunk_size;
51 [1] hi->size=chunk_size=stream_read_dword(s); /* include itself */
52 stream_read(s,chunk_id,4);
53 if(*((uint32_t *)&chunk_id[0])==mmioFOURCC('C','O','M','M'))
54 {
55 [2] char buf[chunk_size-8];
56 unsigned i,subchunk_size;
57 [3] if(stream_read(s,buf,chunk_size-8)!=chunk_size-8) return NULL;
86 i+=subchunk_size+4;
87 while(i<chunk_size-8)
88 {
89 unsigned slen,sid;
90 [4] char sdata[chunk_size];
91 sid=*((uint32_t *)&buf[i]); i+=4;
92 [5] slen=be2me_32(*((uint32_t *)&buf[i])); i+=4;
93 if(sid==mmioFOURCC('D','S','I','Z'))
94 {
95 hi->Dsiz=be2me_32(*((uint32_t *)&buf[i]));
96 continue; /* describes the same info as size of DATA chunk */
97 }
98 [6] memcpy(sdata,&buf[i],slen); sdata[slen]=0; i+=slen;

[1] The unsigned int variable "chunk_size" is filled with a user controlled
value from the media file.
[2] The value of "chunk_size" is used to calculate the length of the stack
buffer "buf".
[3] "buf" is filled with user controlled data from the media file.
[4] The value of "chunk_size" is again used as a length specifier for
another stack buffer called "sdata".
[5] The unsigned int variable "slen" is filled with a user controlled value
from the media file.
[6] This memcpy() function copies "slen" bytes of user controlled data from
"buf" into the stack buffer "sdata". As "slen", the source data as well
as the size of the destination buffer "sdata" are user controlled this
leads to an exploitable stack buffer overflow vulnerability.


Upgrade to MPlayer 1.0rc2 >= r28150 (see [1]) or MPlayer SVN trunk
>= r28149 (see [2]).


2008/12/07 - MPlayer maintainers notified (no response)
2008/12/13 - MPlayer maintainers notified a 2nd time
2008/12/13 - Patch developed by MPlayer maintainers
2008/12/14 - Public disclosure of vulnerability details by MPlayer
2008/12/14 - Release date of this security advisory


Vulnerability found and advisory written by Tobias Klein.


[1] http://svn.mplayerhq.hu/mplayer?view=rev&revision=28150
[2] http://svn.mplayerhq.hu/mplayer?view=rev&revision=28149
[3] http://www.trapkit.de/advisories/TKADV2008-014.txt


Revision 0.1 - Initial draft release to the vendor
Revision 1.0 - Public release


The information within this advisory may change without notice. Use
of this information constitutes acceptance for use in an AS IS
condition. There are no warranties, implied or express, with regard
to this information. In no event shall the author be liable for any
direct or indirect damages whatsoever arising out of or in connection
with the use or spread of this information. Any use of this
information is at the user's own risk.

PGP Signature Key:


Copyright 2008 Tobias Klein. All rights reserved.

Version: GnuPG


[ reply ]


Privacy Statement
Copyright 2010, SecurityFocus