Null HTTPd远程堆缓冲区溢出漏洞

漏洞信息详情

Null HTTPd远程堆缓冲区溢出漏洞

漏洞简介

Null HTTPd是一款小型多线程的WEB服务程序,可使用在Linux和Windows操作系统下。

Null HTTPd在处理Content-Length为负值的请求时存在问题,远程攻击者可以利用这个漏洞进行基于堆的缓冲区溢出,以Web进程在系统上执行任意指令。

漏洞公告

临时解决方法:

如果您不能立刻安装补丁或者升级,CNNVD建议您采取以下措施以降低威胁:

* 暂时在边界防火墙设置策略,只允许可信IP访问Null HTTPd。

厂商补丁:

NullLogic

———

采用如下补丁程序:

diff -Nru nullhttpd-0.5.0/src/format.c nullhttpd-0.5.1-pre/src/format.c

— nullhttpd-0.5.0/src/format.c Sun Feb 3 18:18:22 2002

+++ nullhttpd-0.5.1-pre/src/format.c Sun Sep 15 21:55:09 2002

@@ -153,3 +153,29 @@

}

return 0;

}

+

+int printht(const char *format, …)

+{

+ unsigned char buffer[1024];

+ int offset=0;

+ va_list ap;

+

+ va_start(ap, format);

+ vsnprintf(buffer, sizeof(buffer)-1, format, ap);

+ va_end(ap);

+ while (buffer[offset]) {

+ if (buffer[offset]=='<‘) {

+ prints(“<“);

+ } else if (buffer[offset]==’>’) {

+ prints(“>”);

+ } else if (buffer[offset]==’&’) {

+ prints(“&”);

+ } else if (buffer[offset]=='”‘) {

+ prints(“””);

+ } else {

+ prints(“%c”, buffer[offset]);

+ }

+ offset++;

+ }

+ return 0;

+}

diff -Nru nullhttpd-0.5.0/src/http.c nullhttpd-0.5.1-pre/src/http.c

— nullhttpd-0.5.0/src/http.c Sun Feb 3 18:18:22 2002

+++ nullhttpd-0.5.1-pre/src/http.c Sun Sep 15 21:55:09 2002

@@ -149,8 +149,15 @@

while ((line[strlen(line)-1]==’\n’)||(line[strlen(line)-1]==’\r’)) line[strlen(line)-1]=’\0′;

if (strncasecmp(line, “Connection: “, 12)==0)

strncpy(conn[sid].dat->in_Connection, (char *)&line+12, sizeof(conn[sid].dat->in_Connection)-1);

– if (strncasecmp(line, “Content-Length: “, 16)==0)

+ if (strncasecmp(line, “Content-Length: “, 16)==0) {

conn[sid].dat->in_ContentLength=atoi((char *)&line+16);

+ if (conn[sid].dat->in_ContentLength<0) {

+ // Negative Content-Length? If so, the client is either broken or malicious.

+ // Thanks to <ilja@idefense.be> for spotting this one.

+ logerror(“ERROR: negative Content-Length of %d provided by client.”, conn[sid].dat->in_ContentLength);

+ conn[sid].dat->in_ContentLength=0;

+ }

+ }

if (strncasecmp(line, “Cookie: “, 8)==0)

strncpy(conn[sid].dat->in_Cookie, (char *)&line+8, sizeof(conn[sid].dat->in_Cookie)-1);

if (strncasecmp(line, “Host: “, 6)==0)

diff -Nru nullhttpd-0.5.0/src/main.c nullhttpd-0.5.1-pre/src/main.c

— nullhttpd-0.5.0/src/main.c Sun Feb 3 18:18:22 2002

+++ nullhttpd-0.5.1-pre/src/main.c Sun Sep 15 21:55:09 2002

@@ -36,12 +36,17 @@

logaccess(2, “%s – HTTP Request: %s %s”, conn[sid].dat->in_RemoteAddr, conn[sid].dat->in_RequestMethod,

conn[sid].dat->in_RequestURI);

snprintf(file, sizeof(file)-1, “%s%s”, config.server_htdocs_dir, conn[sid].dat->in_RequestURI);

snprintf(conn[sid].dat->out_ContentType, sizeof(conn[sid].dat->out_ContentType)-1, “text/html”);

– if (strncmp(conn[sid].dat->in_RequestURI, “/cgi-bin/”, 9)==0) cgi_main();

– else if (sendfile(sid, file)==0) return;

– else if (dirlist(sid)==0) return;

– else {

+ if (strncmp(conn[sid].dat->in_RequestURI, “/cgi-bin/”, 9)==0) {

+ cgi_main();

+ } else if (sendfile(sid, file)==0) {

+ return;

+ } else if (dirlist(sid)==0) {

+ return;

+ } else {

send_header(sid, 0, 200, “OK”, “1”, “text/html”, -1, -1);

– prints(“

The file or function ‘%s’ could not be found.
\n”, conn[sid].dat->in_RequestURI);

+ prints(“

The file or function ‘”);

+ &nbs

参考网址

来源: BID

名称: 5774

链接:http://www.securityfocus.com/bid/5774

来源: XF

名称: null-httpd-contentlength-bo(10160)

链接:http://www.iss.net/security_center/static/10160.php

来源: freshmeat.net

链接:http://freshmeat.net/releases/97910/

来源: BUGTRAQ

名称: 20020922 remote exploitable heap overflow in Null HTTPd 0.5.0

链接:http://archives.neohapsis.com/archives/bugtraq/2002-09/0284.html

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享