4507-nginx-servertoken - Ensure the server_tokens directive is set to off
Rule ID
Category
Level
Supported Versions
Description
- The
server_tokens directive controls whether NGINX version and operating system version are displayed in error pages and the Server HTTP response header field. This information should not be disclosed.
Scan Frequency
Rationale
- Attackers can use these response headers to perform reconnaissance on the website and then launch targeted attacks against specific known vulnerabilities in the underlying technology. Hiding the version slows down and blocks some potential attackers.
Risk Item
Audit Method
- Execute the following command to verify:
curl -I 127.0.0.1 | grep -i server
# If the result is as shown below, it is recommended to disable server_token
Server: nginx/1.14.0
- Execute the following command:
To disable the
server_tokens directive, set it to off inside the server block in nginx.conf:
server {
...
server_tokens off;
...
}
Impact
Default Value
- By default, the default value of
server_tokens is on.
References
CIS Controls