dotvitals

A response header is malformed

MediumConfirmedweb.security-headers.malformed-value

What this check looks for

One of the headers contains something that should not be in a header — a line break, or a value far longer than any header needs.

Why it matters

A line break inside a header value is the signature of HTTP response splitting: it means something the server put into a header was not escaped, and an attacker who controls that value can forge whole responses.

When the check passes, your report says: “Every response header is well formed”.

What it costs your score

When this check fails it removes 8 points from your Web security score, before the status, confidence and repeat multipliers are applied. Web security carries a weight of 8 in the overall score.

It shares the web-security.headers family ceiling of 20 points: however many findings that family produces, together they cannot remove more than that from Web security. One underlying problem showing up in several places is still one problem.

Severity
medium
Default confidence
confirmed
Status when triggered
warn
Deduction
8 points
Family cap
web-security.headers · 20
Category
Web security
Module
Web security headers
Fix owned by
user
In the ruleset since
2026.09

How the whole score is calculated

How to fix it

Find the code that builds the header and escape or reject the input it uses.

A line break in a header value means response splitting is possible.

  1. Identify the header and the value that goes into it.

  2. Reject or strip CR and LF from anything request-derived before it reaches a header.

  3. Use the platform's header API rather than writing raw response bytes.

How to confirm it worked

  • curl -sSI https://‹host›/ | cat -A | grep -c '\^M' — expect only line endings

A named slot like ‹domain› — and the braces left in the configuration below — is filled in with your own values when this rule appears on a report.

Remediation by platform

nginx
add_header Content-Security-Policy "default-src 'self'" always;
Apache
<IfModule mod_headers.c>
	Header always set Content-Security-Policy "default-src 'self'"
</IfModule>
Caddy
header {
	Content-Security-Policy "default-src 'self'"
}
Cloudflare
Rules → Overview → Create rule → Response Header Transform Rule → Set static → Content-Security-Policy = default-src 'self'
(Dashboard path as at 2026-09; Cloudflare reorganised these pages and may again.)
  • The always flag matters: without it nginx omits the header on error responses, which are exactly the ones an attacker aims for. Note also that any add_header in a location block discards every add_header inherited from the server block.

  • Shown because the response identified Apache. Put it in the virtual host rather than .htaccess: .htaccess is re-read on every request, and Header always set there runs too late for responses the server generates itself.

  • A Transform Rule adds the header at Cloudflare's edge, so it applies only to responses that reach visitors through Cloudflare. An origin that is reachable directly — by IP, or through a DNS record that is not proxied — still serves the response measured here without it. Setting it at the origin covers both paths.

Technical detail

‹detail›

The offending headers were discarded rather than repaired, so they are absent from the rest of this report — a repaired value is one no client ever saw. Find where the value is constructed: it is almost always request-derived data placed into a header without escaping. An oversized value is usually a bug rather than an attack, but it is truncated by intermediaries and the header stops working somewhere between you and the visitor.

Standards and references

Test this on your domain

Run the check that produces this finding, on its own, against any domain.

Open the web security headers checkerBuild the fix

Other web security headers checks