Hide Webserver Version
Hiding Version Information in Web Servers
Purpose
Sunet continuously scans for vulnerabilities in public-facing systems. To minimize unnecessary alerts and avoid being contacted by Sunet, it is important to take preventive measures. The purpose of this guideline is to reduce false vulnerability alerts and limit exposure of technical information. Web servers should not expose version numbers or information about the underlying operating system in HTTP headers.
Exposing version information can lead to:
- Unnecessary alerts in vulnerability scans
- Information leakage about the system environment
- Increased risk during targeted attacks
Verification of Current Configuration
Check what information the server exposes by running:
Example:
If the response contains, for example:
the version information is visible and the configuration needs adjustment.
Notes on verification:
curl --head(orcurl -I) only requests the HTTP headers, not the full page content.- You should specifically look at the
Server:header to see if it contains versions or OS information. - After correct configuration, headers should show only the server name, e.g.,
Server: nginx, or the header may be removed entirely depending on configuration.
Configuration by Web Server
Nginx (Ubuntu)
Applies to servers using Nginx on Ubuntu.
Action
Open the configuration file:
Ensure the following line exists in the
httpblock. Often,server_tokens off;is already present but commented out—simply remove the # if that is the case:Explanation:
By default, Nginx sends
Server: nginx/<version> (<OS>)in HTTP headers.With
server_tokens off;, the server will send onlyServer: nginx.This hides the version number and operating system, reducing false vulnerability alerts.
Note: This does not remove the
Serverheader completely. Removing it entirely requires theheaders-moremodule:
Restart the service:
Verify the change with:
After the change, only the following should be shown:
Apache (Ubuntu)
Applies to servers using Apache HTTP Server on Ubuntu.
Action
Open the security configuration:
Ensure the following settings are applied:
Explanation:
ServerTokens Prodlimits the header information to justApache.ServerSignature Offremoves version information from error pages.
Restart the service:
Verify with:
Caddy
Caddy does not expose version numbers by default.
No action is required.
Requirements
- Web servers must not expose version numbers in HTTP headers.
- Configuration changes must be verified.
- Checks should be included in regular security reviews and during new installations.