OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
[TKADV2008-014] MPlayer TwinVQ Processing Stack Buffer Overflow Vulnerability

From: Tobias Klein (tktrapkit.de)
Date: Sun Dec 14 2008 - 10:32:40 CST


Please find attached a detailed advisory of the vulnerability.

Alternatively, the advisory can also be found at:
http://www.trapkit.de/advisories/TKADV2008-014.txt

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Advisory: MPlayer TwinVQ Processing Stack Buffer Overflow
                        Vulnerability
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.

=========
Solution:
=========

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

========
History:
========

  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
               maintainers
  2008/12/14 - Release date of this security advisory

========
Credits:
========

  Vulnerability found and advisory written by Tobias Klein.

===========
References:
===========

 [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

========
Changes:
========

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

===========
Disclaimer:
===========

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:
==================

  http://www.trapkit.de/advisories/tk-advisories-signature-key.asc

  
Copyright 2008 Tobias Klein. All rights reserved.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG

iD8DBQFJRTPgkXxgcAIbhEERAozRAJ99w8+Fd/tpkrFK6iWULTNsrUFPCQCgscV3
bq82SPZiJ7lWooDSZUW7en4=
=6hrU
-----END PGP SIGNATURE-----