
POC for the CVE-2023-32681
This is a Python 3 implementation of CVE-2023-32681, affecting clients using the requests version <= 2.30.0.
As per https://www.rfc-editor.org/rfc/rfc9110.html#section-15.4 whenever redirection 3xx is issued by the server then user-agent should modify the request to remove certain headers and fields from the request.
Details of those fields can be found at https://www.rfc-editor.org/rfc/rfc9110.html#section-15.4-5. Specific to this CVE I've highlighted the relevant part here.

requests version <= 2.30.0 didn't remove the "Proxy-Authorization" headers while handling the redirection to "https" and thus leaking the proxy credentials to the redirected server.
More details for the same can be found at
/redirect that redirects the traffic to second server running on 4431./echoHeaders. This route returns the headers it received in the request to the client.Proxy-Authorization headers then the requests version is said to be vulnerable to "CVE-2023-32681".certFile and keyFile variables in server/main.go.go run server/main.go. This will start two servers listening on port 443 and 4431.go run proxy/main.go. This will start the proxy server on port 8080.pip3 install -r script/requirements_request_2_30_0.txtpython3 script/poc.py and observe the output. You can see that "Proxy-Authorization" header is returned by the server in the response.
Server also prints the received headers in the logs.pip3 install -r script/requirements_request_2_31_0.txtpython3 script/poc.py and observe the output. You can see that "Proxy-Authorization" header is now not present in the server response.
Same can also be verified in the server logs.
