本文由北京华泰网安公司提供
--------------------------------------------------------------------------------
NJU WEB BBS远程格式化字符串漏洞
1、日期
发现日期:2001年10月
公布日期: (还未发布)
2、存在漏洞软件
NJUWEBBS-0.9是一个用于FB3 &FB2000的WEB to BBS系统,在中国教育网内使用极为广泛
的bbs程序。
该程序存在一些格式化字符串漏洞,可能导致远程用户取得一个bbs shell并进一步提高
权限。
3、受影响版本及系统
影响软件:NJU WEB BBS v0.9,可能包含以前版本
影响系统:Linux
4、细节
a、bbssig.c存在格式化字符串漏洞
$ cat bbssig.c
#include "BBSLIB.inc"
FILE *fp;
int main() {
FILE *fp;
char *ptr, path[256], buf[10000];
init_all();
if(!loginok) http_fatal("匆匆过客不能设置签名档,请先登录");
printf("<center>%s -- 设置签名档 [使用者: %s]<hr>\n",
BBSNAME, currentuser.userid);
sprintf(path, "home/%c/%s/signatures",
toupper(currentuser.userid[0]), currentuser.userid);
if(!strcasecmp(getparm("type"), "1")) save_sig(path);
printf("<form method=post action=bbssig?type=1>\n");
fp=fopen(path, "r");
bzero(buf, 10000);
if(fp) {
fread(buf, 9999, 1, fp);
ptr=strcasestr(buf, "<textarea>");
if(ptr) ptr[0]=0;
fclose(fp);
}
printf("签名档每6行为一个单位, 可设置多个签名档.<table width=610 border=1><tr
><td>");
printf("<textarea name=text rows=20 cols=80 wrap=physicle>\n");
printf(void1(buf));
/*这里存在潜在的格式化字符串漏洞
*/
printf("</textarea></table>\n");
printf("<input type=submit value=存盘> ");
printf("<input type=reset value=复原>\n");
printf("</form><hr>\n");
http_quit();
}
int save_sig(char *path) {
char *buf;
fp=fopen(path, "w");
buf=getparm("text");
fprintf(fp, "%s", buf);
fclose(fp);
printf("签名档修改成功。");
http_quit();
}
-------------
char *void1(unsigned char *s) {
int i;
int flag=0;
for(i=0; s[i]; i++) {
if(flag==0) {
if(s[i]>=128) flag=1;
continue;
}
flag=0;
if(s[i]<32) s[i-1]=32;
}
if(flag) s[strlen(s)-1]=0;
return s;
}
b、bbsmnote.c,bbsplan.c都有类似的情况
c、测试
设置签名档 为%08x.%08x.%08x.%08x.%08x
读出为0000004a.40151a60.78383025.3830252e.30252e78
设置签名档 为%n
直接coredump
Internal Server Error
The server encountered an internal error or misconfiguration and was unable t
o complete your request.
Please contact the server administrator, alert7@netguard.com.cn and inform th
em of the time the error occurred, and anything you might have done that may
have caused the error.
More information about this error may be available in the server error log
5、利用程序
暂不提供
6、解决办法
将printf(void1(buf));改为printf("%s",void1(buf));
7、厂商信息
厂商主页:
http://bbs.nju.edu.cn/软件包下载地址:
http://bbs.nju.edu.cn/download/NJUWEBBS-0.9.tgz8、关于Netgaurd
------------
北京华泰网安信息技术有限公司(China Net Security Technology
Corporation)是一家专业从事计算机网络与信息安全服务、安全产品研发和销售、安全工
程系统集成、计算机网络与信息安全研究、咨询、培训、安全认证等业务的高新技术企业
,是国内领先的计算机网络与信息安全解决方案和服务提供商。
发 现 者: By NetGuard Security Team
alert7 (alert7@netguard.com.cn)
主 页:
http://www.netguard.com.cn --
zhch.bbs@bbs.nju.edu.cn
※ 来源:.南京大学小百合站 bbs.nju.edu.cn.[FROM: dsl.nju.edu.cn]
--
修改:zhch FROM 202.119.32.102
FROM 202.119.32.102