xfocus logo xfocus title
首页 焦点原创 安全文摘 安全工具 安全漏洞 焦点项目 焦点论坛 关于我们
English Version

mpg123不正确帧大小计算导致内存破坏漏洞


发布时间:2003-01-16
更新时间:2003-01-16
严重程度:
威胁程度:远程拒绝服务
错误类型:意外情况处置错误
利用方式:服务器模式

BUGTRAQ ID:6629

受影响系统
mpg123 mpg123 pre0.59s
mpg123 mpg123 0.59 r
详细描述
mpg123是*NIX下的MP3播放程序。

其中在播放部分MP3文件时存在漏洞,如果播放的MP3文件字节为零,MPG123会应该不正确分配负的framesize缓冲区而导致发生内存破坏。存在执行任意代码可能。

测试代码
尚无

解决方案
for 0.59r:

--- common.old  2003-01-15 21:42:15.000000000 +0300
+++ common.c    2003-01-15 21:42:38.000000000 +0300
@@ -123,7 +123,7 @@
        return FALSE;
     if(!((head>>17)&3))
        return FALSE;
-    if( ((head>>12)&0xf) == 0xf)
+    if( ((head>>12)&0xf) == 0xf || (head>>12)&0xf) == 0)
        return FALSE;
     if( ((head>>10)&0x3) == 0x3 )
        return FALSE;

for pre0.59s:

--- common.old  2003-01-15 20:51:15.000000000 +0300
+++ common.c    2003-01-15 20:25:26.000000000 +0300
@@ -127,7 +127,7 @@
        return FALSE;
     if(!((head>>17)&3))
        return FALSE;
-    if( ((head>>12)&0xf) == 0xf || (head>>12)&0xf) == 0)
+    if( ((head>>12)&0xf) == 0xf)
        return FALSE;
     if( ((head>>10)&0x3) == 0x3 )
        return FALSE;
@@ -140,7 +140,7 @@
  *       -1: giving up
  *        1: synched
  */
-#define MAX_INPUT_FRAMESIZE 1920
+#define MAX_INPUT_FRAMESIZE 4096
#define SYNC_HEAD_MASK    0xffff0000
#define SYNC_HEAD_MASK_FF 0x0000f000
#define LOOK_AHEAD_NUM 3
@@ -237,6 +237,8 @@
         }
      }
      else {
+       if(frameInfo.framesize > MAX_INPUT_FRAMESIZE) return 0;
+
         if(!rds->read_frame_body(rds,dummybuf,frameInfo.framesize))
            return 0;

相关信息
3APA3A <3APA3A@SECURITY.NNOV.RU>
参考:http://online.securityfocus.com/archive/1/306903