漏洞信息详情
Apache ap_escape_html内存分配远程拒绝服务漏洞
- CNNVD编号:CNNVD-200408-043
- 危害等级: 中危
- CVE编号:
CVE-2004-0493
- 漏洞类型:
其他
- 发布时间:
2004-06-28
- 威胁类型:
远程
- 更新时间:
2005-10-20
- 厂 商:
avaya - 漏洞来源:
Georgi Guninski※ g… -
漏洞简介
Apache是一款开放源代码流行的Web服务程序。
Apache ap_escape_html内存分配存在问题,远程攻击者可以利用这个漏洞对Apache服务程序进行拒绝服务攻击。
问题存在于server/protocol.c ap_get_mime_headers_core:
——
if (last_field != NULL) {
if ((len > 0) && ((*field == \’\’\t\’\’) || *field == \’\’ \’\’)) {
…
fold_buf = (char *)apr_palloc(r->pool, alloc_len);
—–
如果头字段以TAB或SPACE开始,Apache就会分配内存给它。
而在ap_escape_html(r->pool, last_field)函数中,last_field字段可以任意长,根据如下代码:
—-
int i, j;
for (i = 0, j = 0; s[i] != \’\’\0\’\’; i++)
if (s[i] == \’\’<\’\’ || s[i] == \’\’>\’\’)
j += 3;
else if (s[i] == \’\’&\’\’)
j += 4;
if (j == 0)
return apr_pstrmemdup(p, s, i);
x = apr_palloc(p, i + j + 1);
—-
(i + j + 1)也可以是任意长度,导致分配任意内存,可消耗大量资源。在linux x86_64上证实发送820MB数据可以溢出(i+j+1),导致memcpy崩溃而引起拒绝服务。
漏洞公告
临时解决方法:
如果您不能立刻安装补丁或者升级,CNNVD建议您采取以下措施以降低威胁:
* Georgi Guninski提供如下第三方补丁:
———————————-
Index: server/protocol.c
===============================================
RCS file: /home/cvspublic/httpd-2.0/server/protocol.c,v
retrieving revision 1.148
diff -u -r1.148 protocol.c
— server/protocol.c 22 Apr 2004 22:38:03 -0000 1.148
+++ server/protocol.c 13 Jun 2004 19:47:36 -0000
@@ -716,6 +716,23 @@
* continuations that span many many lines.
*/
apr_size_t fold_len = last_len + len + 1; /* trailing null */
+
+ if ((fold_len – 1) > r->server->limit_req_fieldsize) {
+ r->status = HTTP_BAD_REQUEST;
+ /* report what we have accumulated so far before the
+ * overflow (last_field) as the field with the problem
+ */
+ apr_table_setn(r->notes, “error-notes”,
+ apr_pstrcat(r->pool,
+ “Size of a request header field ”
+ “after folding “
+ “exceeds server limit.
\n”
+ “
\n",+ ap_escape_html(r->pool, last_field),
+ "
\n”, NULL));
+ return;
+ }
+
if (fold_len > alloc_len) {
char *fold_buf;
alloc_len += alloc_len;
———————————-
厂商补丁:
Apache Software Foundation
————————–
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://jakarta.apache.org/tomcat/index.html” target=”_blank”>
http://jakarta.apache.org/tomcat/index.html
参考网址
来源: BID
名称: 10619
链接:http://www.securityfocus.com/bid/10619
来源: XF
名称: apache-apgetmimeheaderscore-dos(16524)
链接:http://xforce.iss.net/xforce/xfdb/16524
来源: TRUSTIX
名称: 2004-0039
链接:http://www.trustix.org/errata/2004/0039/
来源: REDHAT
名称: RHSA-2004:342
链接:http://www.redhat.com/support/errata/RHSA-2004-342.html
来源: www.guninski.com
链接:http://www.guninski.com/httpd1.html
来源: www.apacheweek.com
链接:http://www.apacheweek.com/features/security-20
来源: GENTOO
名称: GLSA-200407-03
链接:http://security.gentoo.org/glsa/glsa-200407-03.xml
来源: OVAL
名称: oval:org.mitre.oval:def:10605
链接:http://oval.mitre.org/repository/data/getDef?id=oval:org.mitre.oval:def:10605
来源: HP
名称: SSRT4777
链接:http://marc.theaimsgroup.com/?l=bugtraq&m=109181600614477&w=2
来源: FULLDISC
名称: 20040628 DoS in apache httpd 2.0.49, yet still apache much better than windows
链接:http://lists.grok.org.uk/pipermail/full-disclosure/2004-June/023133.html
来源: MANDRAKE
名称: MDKSA-2004:064
链接:http://www.mandriva.com/security/advisories?name=MDKSA-2004:064
来源: BUGTRAQ
名称: 20040629 TSSA-2004-012 – apache
链接:http://marc.theaimsgroup.com/?l=bugtraq&m=108853066800184&w=2