search menu icon-carat-right cmu-wordmark

CERT Coordination Center

Apache mod_rewrite contains off-by-one error in ldap scheme handling

Vulnerability Note VU#395412

Original Release Date: 2006-07-28 | Last Revised: 2006-10-18

Overview

A vulnerability in a common Apache HTTP server module, mod_rewrite, could allow a remote attacker to execute arbitrary code on an affected web server.

Description

The Apache HTTP server distribution includes a number of supplemental modules that provide additional functionality to the web server. One of these modules, mod_rewrite, provides a rule-based rewriting engine to rewrite requested URLs "on the fly" based on regular expressions.

An off-by-one error exists in the ldap scheme handling in mod_rewrite. For some RewriteRules, specifically those where the remote user can influence the beginning of a rewritten URL and that do not include any of the following flags: Forbidden (F), Gone (G), or NoEscape (NE), this could lead to a pointer being written out of bounds. This flaw causes a remotely exploitable vulnerability on web servers that have mod_rewrite enabled (configuration directive "RewriteEngine on") and configured to use certain rules. For example, rules with this format expose the vulnerability:

RewriteRule fred/(.*)  $1

While rules with this format do not expose the vulnerability:

RewriteRule fred/(.*)  joe/$1

The versions of the mod_rewrite module supplied with the Apache HTTP server versions

    • 1.3 branch from 1.3.28
    • 2.0 branch from 2.0.46
    • 2.2 branch from 2.2.0

are vulnerable to this issue but earlier versions are not. The Apache Software Foundation notes that mod_rewrite is not enabled and configured as a normal default, however it is a commonly used module and may be provided in a vulnerable configuration by redistributors.

Impact

An attacker may be able to execute arbitrary code in the context of the web server user (e.g., "apache", "httpd", "nobody", "SYSTEM", etc.). The Apache Software Foundation notes that, due to the nature of the underlying flaw, successful exploitation is dependent upon the stack frame layout of apache running on the target host.

Solution

Apply a patch from the vendor

Patches have been released to address this vulnerability. Please see the Systems Affected section of this document for more details.

Workarounds


Disable mod_rewrite if it is not required in your web server configuration. Instructions for doing this can be found in the Apache HTTP server documentation. Sites, particularly those that are not able to apply the patches, are encouraged to implement this workaround.

Vendor Information

395412
 

View all 43 vendors View less vendors


CVSS Metrics

Group Score Vector
Base
Temporal
Environmental

References

Acknowledgements

Thanks to Mark Cox of the Apache Software Foundation for reporting this vulnerability. Mark, in turn, credits Mark Dowd of McAfee AVERT Labs with reporting this issue.

This document was written by Chad R Dougherty.

Other Information

CVE IDs: CVE-2006-3747
Severity Metric: 6.48
Date Public: 2006-07-27
Date First Published: 2006-07-28
Date Last Updated: 2006-10-18 12:52 UTC
Document Revision: 43

Sponsored by CISA.