2.5.4 Ensure the NGINX reverse proxy does not enable information disclosure

Information

When NGINX acts as a reverse proxy, it forwards headers sent by the upstream application (e.g., \" X-Powered-By: Custom_APP \" or \" Server: Apache/2.4 \"). These headers should be stripped before the response reaches the client to prevent information disclosure about the backend infrastructure.

Attackers conduct reconnaissance by inspecting response headers to identify the technologies used in the backend (e.g., specific versions of PHP, Java/Tomcat, or Python frameworks). Knowing the exact version allows attackers to target specific CVEs associated with that software stack. Removing these headers reduces the information available for targeted attacks.

Solution

Configure NGINX to strip the sensitive headers. The directive depends on the upstream protocol (HTTP Proxy vs. FastCGI).

For Standard Reverse Proxy ( proxy_pass ):

Add the following directives to your http, server, or location block:

proxy_hide_header X-Powered-By;
proxy_hide_header Server;

For PHP/FastCGI ( fastcgi_pass ):

If you are using FastCGI (e.g., for PHP-FPM), use the fastcgi_hide_header directive instead:

fastcgi_hide_header X-Powered-By;

See Also

https://workbench.cisecurity.org/benchmarks/18528

Item Details

Category: SYSTEM AND SERVICES ACQUISITION

References: 800-53|SA-3, CSCv7|18.1

Plugin: Unix

Control ID: 0b5d952338bdd2e6c4dbd637f10ffbc08b8d12f166344b42d339b0314728891e