Fingerprinting: identifying the web server and its services

The video is hosted by YouTube (Google). When played, YouTube may set cookies.

Fingerprinting is the process of determining the type and version of the software used by the publicly exposed services of a server. Attackers can use this information to identify known vulnerabilities and exploit them to compromise the web server and gain unauthorised access to sensitive data.

Fingerprinting weaknesses are dangerous because they let attackers learn which software runs on a server, which helps them launch more targeted attacks. For example, if an attacker knows a web server runs an old version, they can use an exploit designed specifically for that vulnerability.

Moreover, once an attacker gains access to a server, they can use it to attack other systems on the network or as a pivot point to reach other systems. This can lead to the compromise of the whole organisation.

It is therefore important to prevent server fingerprinting by updating software regularly, removing unnecessary information from service and web server responses, and implementing security measures such as firewalls and intrusion detection systems.

Web server fingerprinting

Web server fingerprinting is the process of finding out the type and version of the web server a system uses. It can be done with many automated or manual tools.

Remediation:

Apache2

  1. Add the following two lines to the Apache2 configuration file:
    ServerSignature Off
    ServerTokens Prod
  2. Restart the web server

Nginx

  1. Add to the Nginx configuration file:
    http{
    ...
    server_tokens off;
    ...
    }
  2. Restart the web server

IIS

  1. Add to the web server configuration file (web.config), right after <system.web>:
    <httpRuntime enableVersionHeader="false" />
  2. Restart the web server

References:

  • https://httpd.apache.org/docs/2.4/mod/core.html#serversignature
  • https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/01-Information_Gathering/02-Fingerprint_Web_Server

The "X-Powered-By" header

The video is hosted by YouTube (Google). When played, YouTube may set cookies.

This response header describes the technologies used by the web server. It exposes the server to attackers, who can use the information it provides to find vulnerabilities much more easily.

Remediation:

Option 1
  1. Add the following line to the Apache2 configuration file*:
    Header always unset "X-Powered-By"
  2. Restart the web server
* in some cases the line above will not work; in that case try: Header unset "X-Powered-By"

Option 2 (PHP only)

  1. Edit the PHP configuration file, php.ini, and replace the line expose_php = on with:
    expose_php = off
    (If the line does not exist, add it)
  2. Restart the web server
  • fingerprinting
  • information disclosure
  • information gathering
  • x-powered-by
  • cybersecurity
  • web security
Iulian Băncău

Security Engineer · All Safe

More than CyberSecurity

We offer a variety of services to help companies be prepared for real cyber attacks.