Author: mjc
Date: Mon Dec 12 08:41:53 2005
New Revision: 356279
URL: http://svn.apache.org/viewcvs?rev=356279&view=rev
Log:
Fix moderate security issue CVE-2005-3352 mod_imap cross-site scripting flaw
Submitted by: Mark Cox <mjc apache.org>
Reviewed by: jorton, mjc, fielding
PR: 37874
Modified:
httpd/httpd/branches/2.0.x/CHANGES
httpd/httpd/branches/2.0.x/modules/mappers/mod_imap.c
httpd/httpd/branches/2.0.x/server/util.c
Modified: httpd/httpd/branches/2.0.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/CHANGES?rev=356279&r1=356278&r2=356279&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.0.x/CHANGES [utf-8] Mon Dec 12 08:41:53 2005
@@ -1,6 +1,12 @@
-*- coding: utf-8 -*-
Changes with Apache 2.0.56
+ *) SECURITY: CVE-2005-3352 (cve.mitre.org)
+ mod_imap: Escape untrusted referer header before outputting in HTML
+ to avoid potential cross-site scripting. Change also made to
+ ap_escape_html so we escape quotes. Reported by JPCERT.
+ [Mark Cox]
+
*) mod_cgi(d): Remove block on OPTIONS method so that scripts can
respond to OPTIONS directly rather than via server default.
[Roy Fielding] PR 15242
Modified: httpd/httpd/branches/2.0.x/modules/mappers/mod_imap.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/modules/mappers/mod_imap.c?rev=356279&r1=356278&r2=356279&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/modules/mappers/mod_imap.c (original)
+++ httpd/httpd/branches/2.0.x/modules/mappers/mod_imap.c Mon Dec 12 08:41:53 2005
@@ -342,7 +342,7 @@
if (!strcasecmp(value, "referer")) {
referer = apr_table_get(r->headers_in, "Referer");
if (referer && *referer) {
- return apr_pstrdup(r->pool, referer);
+ return ap_escape_html(r->pool, referer);
}
else {
/* XXX: This used to do *value = '\0'; ... which is totally bogus
Modified: httpd/httpd/branches/2.0.x/server/util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/server/util.c?rev=356279&r1=356278&r2=356279&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/server/util.c (original)
+++ httpd/httpd/branches/2.0.x/server/util.c Mon Dec 12 08:41:53 2005
@@ -1762,6 +1762,8 @@
j += 3;
else if (s[i] == '&')
j += 4;
+ else if (s[i] == '"')
+ j += 5;
if (j == 0)
return apr_pstrmemdup(p, s, i);
@@ -1779,6 +1781,10 @@
else if (s[i] == '&') {
memcpy(&x[j], "&", 5);
j += 4;
+ }
+ else if (s[i] == '"') {
+ memcpy(&x[j], """, 6);
+ j += 5;
}
else
x[j] = s[i];
|