Httpoxy is a security vulnerability that affects web applications that run on servers using CGI (Common Gateway Interface) to process HTTP requests. The vulnerability allows an attacker to manipulate the HTTP_PROXY
environment variable, which can be used to proxy HTTP requests through a malicious server. This can lead to various attacks, such as cross-site scripting (XSS) or man-in-the-middle attacks.
To fix the Httpoxy vulnerability in a CGI-based web application on Linux or Unix, you will need to take the following steps:
Patch the vulnerable software:
If you are using a web server or application that is vulnerable to Httpoxy, you should update to the latest version to receive a patch for the vulnerability. This will typically involve upgrading the web server or application software, or applying a security patch.
Configure the web server to block or ignore the HTTP_PROXY
environment variable:
If it is not possible to patch the vulnerable software, you can configure the web server to block or ignore the HTTP_PROXY
environment variable. This will prevent the vulnerability from being exploited, even if the software is still vulnerable.
In Nginx, you can use the fastcgi_param
directive to specify which environment variables should be passed to the CGI script. To block the HTTP_PROXY
variable, you can add the following line to the fastcgi_param
block in the Nginx configuration file:
fastcgi_param HTTP_PROXY "";
SetEnvIf
directive to specify which environment variables should be passed to the CGI script. To block the HTTP_PROXY
variable, you can add the following line to the Apache configuration file:SetEnvIf HTTP_PROXY "(.*)" block_http_proxy=1 RequestHeader unset HTTP_PROXY env=block_http_proxy