You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2022/04/26 20:29:24 UTC

[Bug 66033] New: Latent read beyond bounds in ap_is_matchexp()

https://bz.apache.org/bugzilla/show_bug.cgi?id=66033

            Bug ID: 66033
           Summary: Latent read beyond bounds in ap_is_matchexp()
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: generalbugs@zippenhop.com
  Target Milestone: ---

An apparently-latent read-beyond-bounds bug exists in ap_is_matchexp()
(server/util.c). [1] The bug is caused by an overflow when the string being
scanned is > 0x7fffffff characters long. The offending code (from trunk) is:

252: AP_DECLARE(int) ap_is_matchexp(const char *str)
253: {
254:     int x;
255:
256:     for (x = 0; str[x]; x++)
257:         if ((str[x] == '*') || (str[x] == '?'))
258:             return 1;
259:     return 0;
260: }

The problem occurs when line 256 increments |x| from 0x7fffffff (positive) to
0x80000000 (negative after overflow). At that point, 0x80000000 further reads
occur from |str-0x80000000|, |str-0x7fffffff| ... |str| (unless there is a
terminating 0 somewhere in that range). This bug can also cause an infinite
loop if there is no terminating 0 between |str| and |str+0x7fffffff|, and
between |str-0x80000000| and |str-1|.

The bug appears to be latent, at least as of httpd v.2.4.53, in which the only
uses are in push_item() (modules/generators/mod_autoindex.c) and
set_server_alias() (server/core.c).

push_item() appears to be used only with internally-generated strings derived
from the server's filesystem, and so should not be asked to handle any strings
long enough to trigger the bug.

set_server_alias() processes the "ServerAlias" directive from httpd.conf, and
so also should not be asked to handle any strings long enough to trigger the
bug.

[1] The security team asked me to file this bug publicly.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 66033] Latent read beyond bounds in ap_is_matchexp() [zhbug_httpd_46.2]

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66033

generalbugs@zippenhop.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Latent read beyond bounds   |Latent read beyond bounds
                   |in ap_is_matchexp()         |in ap_is_matchexp()
                   |                            |[zhbug_httpd_46.2]

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 66033] Latent read beyond bounds in ap_is_matchexp()

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66033

--- Comment #1 from Ruediger Pluem <rp...@apache.org> ---
Fixed in trunk as r1900306.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 66033] Latent read beyond bounds in ap_is_matchexp()

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66033

Ruediger Pluem <rp...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |FixedInTrunk,
                   |                            |PatchAvailable

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org