Summary:
A critical vulnerability, CVE-2024-38473, was discovered in Apache HTTP Server’s mod_proxy (versions 2.4.59 and earlier). This encoding flaw allows attackers to craft URLs in a way that the backend service receives a differently-interpreted request than originally intended, potentially bypassing authentication and exposing your application’s data and functions to unauthorized users.
What is mod_proxy and Why Does it Matter?
mod_proxy is a popular Apache module that lets your HTTP server forward requests to other servers. This is used for reverse proxies, load balancers, or when implementing sophisticated architectures such as microservices.
How the Vulnerability Works: Encoding Confusion
Web servers, clients, and applications use URL encoding to safely transfer data in URLs. For example, a space character is represented as %20.
Backend servers may decode them again, or interpret them differently
- Attackers can use this to "smuggle" requests—tricking the backend to believe a request is allowed, bypassing protections or controls on the proxy
Suppose your Apache is configured like this
ProxyPass /app/ http://backend.local/app/
ProxyPassReverse /app/ http://backend.local/app/
An attacker wants to bypass an authentication requirement for /app/admin.
They use a double-encoded slash in the URL
/app/%2e%2e%2fadmin
%2e%2e is ..
- %2f is /
So it decodes to /app/../admin (which is /admin).
Step 2: Proxy Passes It Along
Depending on mod_proxy’s flaw, the *backend* might see just /admin, while your proxy logs /app/%2e%2e%2fadmin.
If your auth rules protect /admin only on the frontend, and trust the proxy for /app/, the backend will serve /admin without realizing it’s being accessed by a bypassed request!
Proof of Concept (PoC) Code
Here’s a simple example using curl to demonstrate the issue. Imagine the following Apache config:
<VirtualHost *:80>
ProxyPass /service/ http://backend.local/service/
ProxyPassReverse /service/ http://backend.local/service/
</VirtualHost>
<Location "/service/protected">
AuthType Basic
AuthName "Protected"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Location>
Attack with crafted URL
curl -v "http://example.com/service/%2e%2e/protected";
- The proxy may (incorrectly) forward this as /protected to the backend, completely bypassing the /service/protected authentication on the proxy.
References
- Apache Security Advisory for CVE-2024-38473
- mod_proxy documentation
- OWASP: URL Encoding Attacks
How to Fix: Upgrade Now
Apache HTTP Server 2.4.60 fixes this encoding flaw!
Upgrade ASAP to avoid being an easy target.
- If you can’t upgrade, consider
- Adding strict checks for encoded URLs in your Apache/front-end configuration
Conclusion
CVE-2024-38473 is a serious example of how subtle encoding issues can undermine security at the proxy layer. It’s a reminder to never trust the data format or encoding state being forwarded—always apply the principle of "defense in depth” and patch as soon as possible.
Want to stay safe? Monitor your application logs for weird percent-encoded patterns and update Apache to 2.4.60 without delay!
Timeline
Published on: 07/01/2024 19:15:04 UTC
Last modified on: 08/01/2024 13:54:52 UTC