Vulnerability Notice: CVE-2024-38474

Vendor:
Apache, Cert-Hk, Netapp, Apache_Http

Affected Product:
Clustered_Data_Ontap, Http_Server, Apache Http Server

CVSS SCORE:
9.8 of 10 (Critical)

Risk Index:
8.48 of 10 (High)

Description

A critical vulnerability has been identified in the mod_rewrite module of the Apache HTTP Server. This vulnerability, tracked as CVE-2024-38474, could allow an attacker to execute unauthorized scripts in directories permitted by the server’s configuration that are not directly reachable by any URL or could lead to the exposure of source code meant only to be executed as CGI scripts.

 

Affected Product(s)

  • Apache HTTP Server versions 2.4.0 to 2.4.59

 

Technical Details

Apache HTTP Server, commonly referred to as Apache, is a widely used open-source web server software. Within its mod_rewrite module, a critical substitution encoding issue has been discovered. The vulnerability, CVE-2024-38474, allows attackers to manipulate encoded question marks in backreferences, which could result in unauthorized script execution or disclosure of scripts meant to only be executed as CGI.

The mod_rewrite module is designed to provide a rule-based rewriting engine, which is based on a regular-expression parser. This module provides a way to perform URL manipulation, thereby affecting the behavior of the server. In the affected versions, the module incorrectly handles encoded question marks in backreferences, leading to unsafe rewritings.

To exploit this vulnerability, an attacker could craft a specific URL that includes encoded characters, intended to bypass the URL recognition and access control mechanisms that would otherwise restrict unauthorized access to sensitive directories or scripts. The root cause lies in the handling of the backreferences during substitution. When certain RewriteRules are applied, they capture parts of the URLs and substitute them into new URLs improperly. This improper substitution comes from an incorrect encoding of the question mark (?) character, leading to security lapses.

This vulnerability is especially concerning because the degree of access an attacker might gain is dependent on how the web server is configured and the importance of the data or functionalities (like CGI scripts) in the non-directly reachable directories. It provides a gateway for attackers to either execute scripts that they should not have access to or to disclose the content of source scripts.

Apache HTTP Server is used widely across various industries for serving web content, application backends, and many other purposes. Thus, vulnerabilities in such a fundamental and widely deployed software stack have significant implications. The extent of the risk is captured in the CVSS v3 score of 9.8, reflecting its critical nature due to the potential impact on confidentiality, integrity, and availability. The vulnerability also carries a CVSS v2 severity rating of 10.0 due to its relative exploitability and the possible impacts when utilizing legacy systems and configurations.

Several other exploits are possible because of improper encoding issues as well as improper escaping of output issues in mod_rewrite, ranging from bypassing certain authentication mechanisms to causing denial-of-service. Users of Apache HTTP Server versions from 2.4.0 up to but not including 2.4.60 are advised to update to the latest version which resolves these issues.

The Apache Software Foundation has released version 2.4.60, which includes the necessary fixes for this vulnerability. In addition, it introduces a new rewrite flag, “UnsafeAllow3F,” to mitigate some backward compatibility issues caused by the patch where necessary, users should exercise caution when enabling it.

For detailed examination and proof of concept, a tool has been developed and posted on GitHub, demonstrating how these vulnerabilities, including CVE-2024-38474, can be exploited under specific conditions. Practical steps to mitigate and patches are available from numerous sources including vendor advisories, which should be followed to safeguard systems against potential exploitation.

 

Weakness

The primary weakness associated with this vulnerability is CWE-116: Improper Encoding or Escaping of Output. This weakness is characterized by the inadequate handling of encoded characters in backreferences during URL rewriting, leading to unauthorized script execution or unintended information disclosure.

 

Impact Assessment

If exploited, this vulnerability could allow an attacker to gain unauthorized access to sensitive data or execute arbitrary code on the affected system. Specifically, attackers might execute scripts in directories that are permitted by the configuration but not directly accessible via any URL, or they could expose the source code of scripts meant to be executed exclusively as CGI, risking the theft of intellectual property or confidential information.

 

Active Exploitation

While we do not have specific information on active exploitation by known adversary groups, GitHub repositories and security advisories have released proof-of-concept (PoC) tools detailing methods to exploit this vulnerability. The presence of such tools increases the likelihood of exploitation attempts in the wild, particularly by actors known for targeting web server vulnerabilities.

 

Ransomware Association

There is no direct evidence linking this specific vulnerability to any known ransomware attacks. However, vulnerabilities in widely used web servers like Apache HTTP Server have historically been leveraged by ransomware groups to gain initial access to target networks, suggesting a potential, albeit indirect, association with ransomware exploitation pathways.

Mitigation and Resolution

We have released a patch that addresses this vulnerability. Users are strongly advised to upgrade to Apache HTTP Server version 2.4.60 immediately. This update fixes the improper encoding issue in mod_rewrite and includes the new “UnsafeAllow3F” flag for backward compatibility where necessary.

 

Recommendations

  • We strongly recommend that all users apply the latest patch as soon as possible.
  • Upgrade your Apache HTTP Server to version 2.4.60.
  • Review and test your RewriteRules to ensure compatibility with the new security measures.
  • Avoid using the “UnsafeAllow3F” flag unless absolutely necessary, and ensure that any exceptions are adequately secured.
  • Monitor logs for any unusual or unauthorized access patterns, especially related to URL rewrites.
  • Conduct regular security audits and vulnerability scans to stay ahead of potential threats.

 

ย Referencesย 

 

View In Platform

Share This Post On