Qualcomm Qpopper 使用不安全的fgets()函数问题
发布日期:2000-04-26
更新日期:2000-04-26
受影响系统:Qualcomm qpopper 3.0
Qualcomm qpopper 2.53
描述:
Qpopper 3.0/2.53存在一个潜在的安全问题。Qpopper用fgets()或者类似的函数mfgets()来
从mailbox中读取数据,当读入1023个字节后或者碰到一个'\n'字符后,Qpopper将数据送入
一个固定大小(1024字节)的缓冲区中,恶意用户可能在邮件正文中输入下列内容:
AAAA...AAA(1023个字节)\n
From user Wed Dec 2 05:53 -0700 1992
In this case fgets() will return 3 strings:
在这种情况下,fgets()将会返回3个字符串:
"AAAA...AAA"(1023字节长)
"\n",
"From user Wed Dec 2 05:53 -0700 1992"
这将会被认为是mailbox中下一条新邮件的开始,在"From"行以后的内容将被错误的认为是下
一条邮件的邮件头和正文部分。攻击者可能伪造邮件,发送木马程序,并能避开一些反病毒软
件的检查。
<* 来源:3APA3A (3APA3A@SECURITY.NNOV.RU) *>
建议:
临时补丁:
--- pop_dropcopy.c Sat Mar 18 02:31:11 2000
+++ pop_dropcopy.c Wed Apr 12 18:11:11 2000
@@ -205,6 +205,8 @@
int newline = 1;
+int isbreaked = 0;
+int wasbreaked = 0;
/*
* 0 for not a from line
@@ -229,6 +231,14 @@
/* If the previous line was not a newline then just return */
/* From message separators are preceeded by a newline */
+ if (isbreaked) {
+ wasbreaked = 1;
+ return ( 0 );
+ }
+ if (wasbreaked) {
+ wasbreaked = 0;
+ return ( 0 );
+ }
if ( *cp == '\n' ) {
newline = 1;
return ( 0 );
@@ -1593,9 +1603,13 @@
if( size <= 0 ) {
return NULL;
}
+ isbreaked = 1;
while( --size && ((c = getc(stream)) != EOF) ) {
if( (*p = (char)c) == '\0' ) *p = ' ';
- if( *p++ == '\n' ) break;
+ if( *p++ == '\n' ) {
+ isbreaked = 0;
+ break;
+ }
}
if( p == s ) return NULL;
*p = '\0';
浏览次数:6050
严重程度:0(网友投票)