]> granicus.if.org Git - apache/commitdiff
mod_proxy_fcgi: SECURITY: CVE-2014-3583 (cve.mitre.org)
authorYann Ylavic <ylavic@apache.org>
Sun, 16 Nov 2014 22:04:39 +0000 (22:04 +0000)
committerYann Ylavic <ylavic@apache.org>
Sun, 16 Nov 2014 22:04:39 +0000 (22:04 +0000)
Fix a potential crash with response headers' size above 8K.

The code changes to mod_authnz_fcgi keep the handle_headers()
function in sync between the two modules.  mod_authnz_fcgi
does not have this issue because it allocated a separate byte
for terminating '\0'.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640036 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/aaa/mod_authnz_fcgi.c
modules/proxy/mod_proxy_fcgi.c

diff --git a/CHANGES b/CHANGES
index b91a5a07af3d294270488df6421b78f7e1cc6296..2fb0c5ef5705f4b0aad6a1de4e44caeac26a5d3b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
   
+  *) SECURITY: CVE-2014-3583 (cve.mitre.org)
+     mod_proxy_fcgi, mod_authnz_fcgi: Fix a potential crash with response
+     headers' size above 8K. [Teguh <chain rop.io>, Yann Ylavic, Jeff Trawick]
+
   *) mod_authnz_ldap: Resolve crashes with LDAP authz and non-LDAP authn since 
      r1608202. [Eric Covener]
  
index 5e4a9378500ac7d91a00ac34b2b2f27f79774011..401fa9950788df0a20749c6c3775721f13e3c26e 100644 (file)
@@ -406,13 +406,12 @@ enum {
  *
  * Returns 0 if it can't find the end of the headers, and 1 if it found the
  * end of the headers. */
-static int handle_headers(request_rec *r,
-                          int *state,
-                          char *readbuf)
+static int handle_headers(request_rec *r, int *state,
+                          const char *readbuf, apr_size_t readlen)
 {
     const char *itr = readbuf;
 
-    while (*itr) {
+    while (readlen--) {
         if (*itr == '\r') {
             switch (*state) {
                 case HDR_STATE_GOT_CRLF:
@@ -555,7 +554,8 @@ static apr_status_t handle_response(const fcgi_provider_conf *conf,
                 APR_BRIGADE_INSERT_TAIL(ob, b);
 
                 if (!seen_end_of_headers) {
-                    int st = handle_headers(r, &header_state, readbuf);
+                    int st = handle_headers(r, &header_state,
+                                            readbuf, readbuflen);
 
                     if (st == 1) {
                         int status;
index ab1118238bf09628871d30c2564725703100a528..79d142cdbe6c49fe67540da7b18547463c6a0526 100644 (file)
@@ -310,13 +310,12 @@ enum {
  *
  * Returns 0 if it can't find the end of the headers, and 1 if it found the
  * end of the headers. */
-static int handle_headers(request_rec *r,
-                          int *state,
-                          char *readbuf)
+static int handle_headers(request_rec *r, int *state,
+                          const char *readbuf, apr_size_t readlen)
 {
     const char *itr = readbuf;
 
-    while (*itr) {
+    while (readlen--) {
         if (*itr == '\r') {
             switch (*state) {
                 case HDR_STATE_GOT_CRLF:
@@ -563,7 +562,8 @@ recv_again:
                     APR_BRIGADE_INSERT_TAIL(ob, b);
 
                     if (! seen_end_of_headers) {
-                        int st = handle_headers(r, &header_state, iobuf);
+                        int st = handle_headers(r, &header_state,
+                                                iobuf, readbuflen);
 
                         if (st == 1) {
                             int status;