TMSNC UBX消息远程栈溢出漏洞

Posted by ArtHack on Jun 25th, 2008 and filed under Notice loopholes. You can follow any responses to this entry through the RSS 2.0. You can also subscribe to us, through the Top of the E-mail - 加入超级QQ群:32843311

受影响系统:
TMSNC TMSNC 0.3.2
描述:
——————————————————————————–
BUGTRAQ  ID: 29850
CVE(CAN) ID: CVE-2008-2828
TMSNC是用C编写的基于文本的MSN客户端。
TMSNC在处理畸形结构的消息数据时存在漏洞,如果远程攻击者向TMSNC发送了畸形的UBX消息消息的话,就可能触发缓冲区溢出,导致执行任意指令。
UBX是类似于UUX的MSN协议,用于通知好友所发生的变化。UBX协议命令的第一个参数为更改了个人消息或当前正在播放歌曲的联络人的护照地址,第二个参数为负载的长度,句法如下:
>>> UBX passport@hotmail.com xxx\r\n
<Data><PSM>My Personal Message</PSM><CurrentMedia></CurrentMedia></Data>
UBX协议是由tmsnc的core_net.c文件中以下代码解析的:
727 int
728 MSN_server_handle(session, message, message_len)

729      MSN_session *session;
730      *message;
731      int message_len;
732 {
733     time_t tm;
734     buf[512], md_hex[48];

748     while (getline(buf, sizeof(buf) – 1, session->sd) > 0) {

833         } else if (strncmp(buf, “UBX”, 3) == 0) {
834             /*
835              * we read the payload of this command·
836              */
837             /*
838              * but do not do anything with it······
839              */
840             if ((ptr[1] = ( *)split(buf, ′ ′, 1)) == NULL ||        //by gfhuang
841                 (ptr[0] = ( *)split(buf, ′ ′, 2)) == NULL) {
842                 strncpy(message, “Couldn′t parse UBX”, message_len – 1);
843                 return -1;
844             }
845             i = atoi(ptr[0]);
846             free(ptr[0]);
847·
848             if (read(session->sd, buf, i) != i) {
849                 strncpy(message, “Couldn′t read UBX payload”,
850                         message_len – 1);
851                 return -1;
852             }
853             // parsing PSM, by gfhuang
854             if(0 == i) buf[0] = 0;      //important, by gfhuang, when i=0, buf is untouched!
在734行消息缓冲区声明为存储512字节的数据,748行读取来自好友联系人的命令行,而如果消息缓冲区包含有类似于以下的UBX消息的话:
UBX passport@hotmail.com xxx\r\n (这里xxx为UBX负载长度)
就会使用833及之后的行。
如果缓冲区的前三个字节匹配UBX且字符串包含有两个传送给ptr[1]和ptr[0]的空间的话,就是一个有效的UBX消息。
split函数来自core_misc.c,基本类似于strchr函数,将指针返回给作为第二个参数的第一个字符串。因此在841行的调 用后,ptr[0]会指向消息长度,然后在845行使用atoi将这个值转换为整数并在848行传送给read函数,之后通过会话套接字从MSN报文读取 UBX负载。因此如果将UBX负载声明为大于sizeof(buffer)或负载长于sizeof(buffer)的话,就会触发栈溢出,导致执行任意指 令。
<*来源:Nico Golde (nion@debian.org

链接:http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487222
*>
建议:
——————————————————————————–
厂商补丁:
TMSNC
—–
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://tmsnc.sourceforge.net/index.html

来源:Nico Golde

Classic Posts

Our Sponsors

Leave a Reply

Our Sponsors

Tag Cloud

Premium Wordpress Themes

wp remix
WooThemes
Gabfire Themes
Themeforest
StyleWP
Translator
Chinese (Simplified) flagChinese (Traditional) flagItalian flagKorean flagPortuguese flagEnglish flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flagAlbanian flagEstonian flagGalician flagMaltese flagThai flagTurkish flagHungarian flag
Log in / Art Hack.All rights reserved.