Bug 64365 (CVE-2004-1311)

Summary: VUL-0: CVE-2004-1311: MPlayer heap overflow
Product: [Novell Products] SUSE Security Incidents Reporter: Ludwig Nussel <lnussel>
Component: IncidentsAssignee: Security Team bot <security-team>
Status: RESOLVED FIXED QA Contact: Security Team bot <security-team>
Severity: Major    
Priority: P3 - Medium CC: sbrabec, security-team
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard: CVE-2004-1311: CVSS v2 Base Score: 10.0 (AV:N/AC:L/Au:N/C:C/I:C/A:C)
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on: 64325    
Bug Blocks: 64367    

Description Ludwig Nussel 2004-12-17 19:50:39 UTC
We received the following report via bugtraq.
The issue is public.

Date: 16 Dec 2004 13:45:21 -0500
From: iDEFENSE Security Advisory <customerservice@idefense.com>
To: bugtraq@securityfocus.com
Subject: iDEFENSE Security Advisory 12.16.04: MPlayer Remote RTSP HeapOverflow Vulnerability
Reply-To: customerservice@idefense.com

MPlayer Remote RTSP Heap Overflow Vulnerability

iDEFENSE Security Advisory 12.16.04
http://www.idefense.com/application/poi/display?id=166
December 16, 2004

I. BACKGROUND

MPlayer is a movie player for Linux that also runs on many other Unices, 
and non- x86 CPUs. It plays most MPEG, VOB, AVI, Ogg/OGM, VIVO, 
ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, YUV4MPEG, FILM, RoQ, PVA 
files, supported by many native, XAnim, and Win32 DLL codecs. You can 
watch VideoCD, SVCD, DVD, 3ivx, DivX 3/4/5 and other formats. 

More information is available at http://mplayerhq.hu/.

II. DESCRIPTION

Remote exploitation of a buffer overflow vulnerability in Unix MPlayer 
could allow remote users to gain access to the computer.

The vulnerability specifically exists due to an error in dynamically 
allocating memory in /libmpdemux/realrtsp/real.c. The vulnerable code
follows:

rmff_header_t  *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t
bandwidth) {
  char *description=NULL;
  char *session_id=NULL;
  rmff_header_t *h;
  char *challenge1;
  char challenge2[64];
  char checksum[34];
  char *subscribe;
  char *buf = xbuffer_init(256);
  char *mrl=rtsp_get_mrl(rtsp_session);
  unsigned int size;
  int status;

[...]
  if (!rtsp_search_answers(rtsp_session,"Content-length"))
    printf("real: got no Content-length!\n");
  else
[!]  size=atoi(rtsp_search_answers(rtsp_session,"Content-length"));
[...]
  description=malloc(sizeof(char)*(size+1));

  if( rtsp_read_data(rtsp_session, description, size) <= 0) {
      buf = xbuffer_free(buf);
    return NULL;
  }
  description[size]=0;
[...]
}       

If a malicious server specifies a content-length of -1 for the stream, 
only 4 bytes are allocated due to an integer overflow. An arbitrary 
length stream of data is then copied into that 4 byte buffer, 
corrupting the heap and allowing for possible code execution
        
III. ANALYSIS

Remote exploitation of this vulnerability is difficult because success 
requires a great deal of precision. If remote exploitation were 
successful, the attacker would be able to gain access with the 
privileges of the user who attempted to play the media file.

IV. DETECTION

iDEFENSE has confirmed that MPlayer version 1.0pre5 is vulnerable.

The following distributions of Linux include MPlayer:
	
	Debian Linux 
	Fedora Linux 
	Gentoo Linux 
	SUSE Linux 

V. WORKAROUND

Users must be careful when accepting and opening media from untrusted 
sources. Do not accept media from those you do not trust. Do not stream 
media from servers you do not trust.

VI. VENDOR RESPONSE

A patch to address this vulnerability is available at:

http://www1.mplayerhq.hu/MPlayer/patches/rtsp_fix_20041215.diff

VII. CVE INFORMATION

A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.

VIII. DISCLOSURE TIMELINE

12/10/2004  Initial vendor notification
12/16/2004  Public disclosure

IX. CREDIT

The discoverer of this vulnerability wishes to remain anonymous.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp

X. LEGAL NOTICES

Copyright � 2004 iDEFENSE, Inc.

Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email customerservice@idefense.com for permission.

Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.
Comment 1 Stanislav Brabec 2004-12-21 00:40:11 UTC
Cummulative patch applied for STABLE and PLUS.

For 8.2 and sles9-slec applied only: bmp_fix_20041215_backport.diff,
mmst_fix_20041215_backport.diff, mp3_fix_20041215.diff, pnm_fix_20041215.diff.
Patch rtsp_fix_20041215.diff not applied, code seems to be completely different.

For 8.1 applied only: bmp_fix_20041215_backport.diff,
mmst_fix_20041215_backport.diff, mp3_fix_20041215.diff. Patches
rtsp_fix_20041215.diff, code seems to be completely different,
pnm_fix_20041215.diff, code is probably net yet there.

Please verify my backports.

For 9.0, 9.1, 9.2 no porting of patch was done! It was never approved for
distribution and never tested, or even not compile. Maybe the code should be
dropped from there.
Comment 2 Stanislav Brabec 2004-12-21 22:42:24 UTC
Patch submitted altogether with fix of:
bug 64325
bug 64367

Reassigning to security team.
Comment 3 Thomas Biege 2005-02-01 19:47:48 UTC
packages approved
Comment 4 Marcus Meissner 2007-12-02 21:25:41 UTC
CVE-2004-1311
Comment 5 Thomas Biege 2009-10-13 20:06:44 UTC
CVE-2004-1311: CVSS v2 Base Score: 10.0 (AV:N/AC:L/Au:N/C:C/I:C/A:C)