Information Assurance |
Chris Piro |
Information AssuranceBugtraq AnalysisRemote heap overflow in http input module of MPlayer |
MPlayer is a popular media player application available for many operating systems. It is possible to invoke MPlayer from the command line or from a web browser with a URL. Typically, this looks like: $ mplayer http://www.mysite.com/some_harmless_looking_movie.mpeg
MPlayer allocates a buffer from the heap, escapes the string given on the command line, and stores the new string in the buffer. However, the buffer allocated may be too small to hold the new string; it can be overflowed. from 178: if( http_hdr->uri==NULL ) http_set_uri( http_hdr, "/"); 179: else { 180: uri = (char*)malloc(strlen(http_hdr->uri)*2); 181: if( uri==NULL ) { 182: mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n"); 183: return NULL; 184: } 185: url_escape_string( uri, http_hdr->uri ); The new escaped string produced on line 185 may be up to three times longer than the original string
(e.g. a space ' Malicious web sites can redirect a user from a harmless looking URL to one
with many un-escaped characters using the The command $ mplayer http://`perl -e 'print "\""x1024;'`
should make MPlayer die with a segfault if it is vulnerable. To work around this problem users can save files and open them locally rather than using MPlayer to download or stream them. The HTTP request code in MPlayer will not be called if the file is played from a local disk. The programmers could have avoided this problem by allocating a buffer large enough to store any encoded string. It should be at least 3 times the size of the unescaped string. Users may upgrade MPlayer; a fix was available the day of the Bugtraq announcement. |