Server & X-Powered-By version headers: free recon for attackers
A header that introduces you to attackers
With every response, your server can send a Server header and sometimes an X-Powered-By header. On their own they sound harmless — they just name the software answering the request. The problem is the detail. Many setups ship something like Server: nginx/1.18.0 or X-Powered-By: Express, and some go further with a full language and framework version. That is a small line with an outsized cost.
Why version disclosure matters
Attacking a site is mostly reconnaissance. Before anything else, an attacker wants to know what they are dealing with: which web server, which framework, which version. The faster they answer that, the faster they can match your stack against a list of known issues.
When your headers spell out the exact version, you have done that work for them:
- They can look up published vulnerabilities for that precise release.
- They can skip the noisy fingerprinting that might otherwise trip alarms.
- They can prioritise you if your version is known to be behind on patches.
None of this means the version header is itself a hole. It is an information-disclosure issue — usually Low or Info severity — but it raises the value of every other weakness on the site. The cost-benefit is lopsided: it gives a defender nothing and an attacker a measurable head start, so removing it is close to free risk reduction.
There is a second, quieter effect too. A site that proudly announces an old version reads as a site that is not actively maintained — which is exactly the signal opportunistic attackers scan for when deciding where to spend their time.
What this is not
It is worth being calibrated here. Hiding your version is not security through obscurity pretending to be a fix, and it does not patch anything. A fully patched server is safe whether or not it advertises its version. The point is simpler: there is no upside to broadcasting it, and a small downside, so you remove the detail and move on.
How to trim the headers
The exact switch depends on your stack, but the shape is always the same — stop emitting the version, or the header entirely:
- nginx: set
server_tokens off;to drop the version from theServerheader. - Apache: set
ServerTokens ProdandServerSignature Off. - Express / Node: call
app.disable('x-powered-by')or use a helmet-style middleware. - ASP.NET: remove the
Serverheader in your pipeline and clearX-Powered-Byin config. - Behind a CDN or proxy: you can often strip or rewrite these headers at the edge, which covers everything at once.
After the change, fetch your own site and read the response headers to confirm the version is gone.
Quietly close the recon gap
Version headers are the kind of thing nobody notices until a scan points them out — they are invisible in the rendered page. An automated check reads your real responses and flags any header that gives away more than it should. Scan your site and see exactly what your headers are telling the world.