
Containerized three-tier lab reproducing CVE-2023-43804 urllib3 cookie leak via cross-origin redirects, with exploit script and patch verification.
The repository includes a fully containerized, three-tier lab environment which is intended for demonstrating, taking advantage of, and verifying the fixes for CVE-2023-43804 (the urllib3 Cookie Leak occurring during cross-origin redirects).
The lab is orchestrated using Docker Compose and consists of three isolated services communicating over an internal bridge network:
victim_client: Python-based container executing the reproduction and exploit script (exploit.py).target_app: Flask web application simulating a vulnerable target server that triggers an HTTP 302 cross-origin redirect to an external origin.attacker_app: Flask logging server designed to capture incoming HTTP requests and extract leaked headers.git clone [https://github.com/deepanshu-khurana/cve-2023-43804-lab.git](https://github.com/deepanshu-khurana/cve-2023-43804-lab.git)
cd cve-2023-43804-lab
docker compose up -d --build
docker compose up -d
docker compose down --volumes
CVE-2023-43804)urllib3< 1.26.17 or < 2.0.5urllib3 failed to strip sensitive authentication headers (such as Cookie) when following HTTP 302 redirects across different origins, allowing untrusted redirection endpoints to intercept sensitive session tokens.urllib3 is installed inside the client container:docker exec -it victim_client pip install urllib3==1.26.16
docker exec -it victim_client python3 -u /lab/exploit.py
"status": "EXFILTRATED" alongside the leaked session token.docker logs attacker_app displays the captured sensitive cookie header.To verify the patch after observing the exploit:
urllib3 inside the client container to the patched version:docker exec -it victim_client pip install urllib3==1.26.17
docker exec -it victim_client python3 -u /lab/exploit.py
"status": "SECURE", "stolen_cookie": "None / Stripped".attacker_app logs confirm that the incoming request contains Leaked Cookie Header: None.requirements.txt to enforce safe versions:urllib3>=1.26.17
remove_headers_on_redirect in custom Retry configurations if maintaining legacy runtimes.victim_client, target_app, attacker_app) as assigned by Docker Compose. Use docker ps to verify active container names.5000 and 5001 are not occupied by other local services before launching the Docker stack.When running the lab on vulnerable urllib3==1.26.16, the sensitive authentication cookie is intercepted across cross-origin redirects and successfully logged by the attacker server.
exploit.py displaying "status": "EXFILTRATED" alongside the leaked session token, verified by attacker_app log output.After upgrading urllib3 to the patched version (1.26.17), the library automatically strips the sensitive Cookie header during cross-origin redirects.
Package Upgrade to Patched Version:

urllib3 inside victim_client via pip install urllib3==1.26.17.Secure Client Output & Stripped Logs:

exploit.py returning "status": "SECURE" with "stolen_cookie": "None / Stripped", confirmed by the server log showing Leaked Cookie Header: None.