Apache may execute a log file vulnerability patch for arbitrary code

Source: Internet
Author: User

Recently, a foreign security researcher found a vulnerability on the Apache server that uses the Rewritelog () function in the modules/mappers/mod_rewrite.c file to incorrectly process certain escape sequences, as a result, malicious attackers can inject specially crafted HTTP requests into log files. If an HTTP request contains the escape sequence of the terminal simulator, attackers may be allowed to execute commands without administrator privileges.
Apache 2.2.x is known to have this vulnerability, but other versions may also be affected. The official release of this vulnerability is as follows:

Index: CHANGES===================================================================--- CHANGES      (revision 1469310)+++ CHANGES      (working copy)@@ -1,8 +1,11 @@                                                          -*- coding: utf-8 -*- Changes with Apache 2.2.25 +  *) SECURITY: CVE-2013-1862 (cve.mitre.org)+     mod_rewrite: Ensure that client data written to the RewriteLog is+     escaped to prevent terminal escape sequences from entering the+     log file.  [Joe Orton] - Changes with Apache 2.2.24    *) SECURITY: CVE-2012-3499 (cve.mitre.org)Index: modules/mappers/mod_rewrite.c===================================================================--- modules/mappers/mod_rewrite.c (revision 1469310)+++ modules/mappers/mod_rewrite.c (working copy)@@ -500,11 +500,11 @@      logline = apr_psprintf(r->pool, "%s %s %s %s [%s/sid#%pp][rid#%pp/%s%s%s] "                                     "(%d) %s%s%s%s" APR_EOL_STR,-                           rhost ? rhost : "UNKNOWN-HOST",-                           rname ? rname : "-",-                           r->user ? (*r->user ? r->user : "\"\"") : "-",+                           rhost ? ap_escape_logitem(r->pool, rhost) : "UNKNOWN-HOST",+                           rname ? ap_escape_logitem(r->pool, rname) : "-",+                           r->user ? (*r->user ? ap_escape_logitem(r->pool, r->user) : "\"\"") : "-",                            current_logtime(r),-                           ap_get_server_name(r),+                           ap_escape_logitem(r->pool, ap_get_server_name(r)),                            (void *)(r->server),                            (void *)r,                            r->main ? "subreq" : "initial",@@ -514,7 +514,7 @@                            perdir ? "[perdir " : "",                            perdir ? perdir : "",                            perdir ? "] ": "",-                           text);+                           ap_escape_logitem(r->pool, text));      nbytes = strlen(logline);     apr_file_write(conf->rewritelogfp, logline, &nbytes);
Patch address: http://people.apache.org /~ Jorton/mod_rewrite-CVE-2013-1862.patch
Mod_rewrite.c source file address for study
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.