keepcalculator

06 Numbers and Powers

Hide Apache Version Info: Why & How

Card No. 06·74438 · Updated · Standard formula, shown below

Yes, you can and should hide the Apache web server version information. By default, Apache sends a response header (Server) and often includes version details in error pages and directory listings, which can help attackers identify known vulnerabilities. This article explains how to suppress or minimize that information and the security context behind it.

Why Hide Apache Version Information

When Apache responds to a request, it typically includes a Server header that looks like Apache/2.4.57 (Ubuntu). This reveals the exact version and often the operating system. Attackers use this to search for known vulnerabilities (CVEs) specific to that version and target your server. Hiding or obfuscating this information reduces the attack surface by forcing attackers to spend more time fingerprinting your server manually.

However, hiding the version is not a complete security measure. It is a form of “security through obscurity” that should be part of a broader defense strategy, including regular updates, patches, and proper server configuration. The goal is to make it slightly harder for automated scanners and casual attackers to identify your exact setup.

What Exactly Does Apache Reveal

Apache can reveal version information in several places:

  • Server header: Sent in every HTTP response. Example: Server: Apache/2.4.41 (Ubuntu)
  • Error pages: Default 404, 403, 500 pages often include “Apache/2.4.41 (Ubuntu)” at the bottom.
  • Directory listings: If autoindex is enabled, the footer may show the Apache version.
  • Server-status and server-info: If these modules are enabled and accessible, they expose detailed version and configuration info.

Even if you hide the header, error pages and directory listings can leak the same information. You need to address all these vectors.

How to Hide Version Information

There are two main approaches: minimal (hide just the version) and thorough (remove all identifiable info). The steps vary slightly depending on your Apache version and OS, but the core directives are the same.

1. Use ServerTokens and ServerSignature

These two directives are the primary controls:

  • ServerTokens Prod – sends only “Apache” (no version or OS).
  • ServerSignature Off – removes the version footer from error pages and directory listings.

Place them in the main configuration file (e.g., httpd.conf or apache2.conf) or inside a <VirtualHost> block. After changing, restart Apache: sudo systemctl restart apache2 (or httpd on RHEL).

2. Remove or Obfuscate the Server Header (mod_headers)

To completely remove the Server header, you can use the mod_headers module:

Header unset Server

This removes the header entirely. Some administrators prefer to set a fake value, but that can cause issues with some clients and is generally discouraged. Removing it is cleaner.

3. Disable or Protect Sensitive Modules

Ensure mod_info and mod_status are not enabled globally. If you need them, restrict access to your IP address using Require ip directives.

4. Check Error Documents

Even with ServerSignature Off, custom error pages you create might still contain version info if you hardcode it. Use generic error pages without version details.

Common Pitfalls and Mistakes

Many tutorials only mention ServerTokens and ServerSignature, but forget that the Server header can still appear in some responses (e.g., from CGI scripts or other modules). Also, if you use a reverse proxy or CDN in front of Apache, the header may be stripped or added by the proxy, so check the final response from the client’s perspective.

Another mistake is setting ServerTokens Full (the default) and then wondering why the version shows. Always verify with curl -I or your browser’s developer tools after making changes.

Finally, remember that hiding the version does not protect against zero-day vulnerabilities. It only slows down reconnaissance.

Security Implications and Limitations

Hiding version info is a low-cost, low-effort hardening step. It is part of the CIS benchmarks and many security checklists. However, it is not a substitute for:

  • Keeping Apache updated to the latest stable version.
  • Disabling unused modules.
  • Using secure TLS configuration.
  • Implementing a web application firewall (WAF).

Attackers can still fingerprint your server by analyzing response headers like X-Powered-By (from PHP), subtle differences in error messages, or by sending specific malformed requests. So, while hiding the version is good practice, it is only one layer.

Alternatives and Advanced Techniques

If you need to completely hide the fact that you are running Apache, you could use a reverse proxy (like Nginx) or a CDN that rewrites headers. However, this adds complexity and may not be necessary for most sites. Another option is to compile Apache from source with a custom SERVER_BASEVERSION string, but this is maintenance-heavy.

For most users, setting ServerTokens Prod and ServerSignature Off is sufficient. You can also use mod_security to filter outgoing headers, but that is overkill for this purpose.

Frequently Asked Questions

Does hiding the version affect performance?

No. The directives only change the content of a header and a line in error pages. The processing overhead is negligible.

Will hiding the version break anything?

Generally, no. Some very old clients or scripts might expect a version string, but in practice, modern browsers and tools do not care. If you remove the Server header entirely, some security scanners might flag it as “missing” but that is not a real issue.

Can I hide the version only for certain virtual hosts?

Yes. You can place ServerTokens and ServerSignature inside a <VirtualHost> block, but note that ServerTokens is a global directive and may not be allowed in all contexts. Check your Apache version’s documentation.

How can I test if it worked?

Use curl -I http://yourdomain.com to see the response headers. Look for the Server header. Also, trigger a 404 error and check the bottom of the page for version info.

Is hiding the version enough to secure my server?

No. It is only a small part of server hardening. You must also keep software updated, use strong passwords, configure firewalls, and monitor logs.

What if I use a control panel like cPanel or Plesk?

Those panels often manage Apache configuration for you. You can usually add the directives via the panel’s “Apache Configuration” section or by editing the included configuration files. Be aware that panel updates may overwrite your changes, so document them.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →