The 7 Security Headers Your API Is Missing
(And Why Attackers Love It)

We scanned 200+ API endpoints across Dutch fintech companies. The average score: 67/100 (Grade D). Most APIs are missing at least 2-3 critical security headers.

TL;DR

HeaderWhat It Prevents% Missing
Strict-Transport-SecurityDowngrade attacks~35%
Content-Security-PolicyXSS, injection~72%
X-Content-Type-OptionsMIME sniffing~28%
X-Frame-OptionsClickjacking~40%
Referrer-PolicyData leakage~55%
Permissions-PolicyFeature abuse~68%
X-XSS-ProtectionReflected XSS~45%

1. Strict-Transport-Security (HSTS)

What it does: Forces HTTPS. No exceptions. No downgrade to HTTP.

Without it: An attacker on the same network (coffee shop, airport) can intercept the initial HTTP request before it redirects to HTTPS. That's enough to steal credentials or inject malicious content.

The fix:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Common mistake: Setting max-age=0 or omitting includeSubDomains. Both leave attack surface open.

2. Content-Security-Policy (CSP)

What it does: Controls which resources can load on your page. The single most effective header against XSS.

Without it: Any script injection vulnerability becomes immediately exploitable. XSS payloads can load external scripts, exfiltrate data, or hijack sessions.

The fix:

Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'

Pro tip: Use hash-based CSP instead of 'unsafe-inline' for scripts:

# Generate SHA-256 hash for inline scripts
echo -n "your script content" | openssl dgst -sha256 -binary | openssl base64

Then reference: script-src 'sha256-BASE64HASH'

✅ We did this on our own sites

Went from Grade D to Grade A by implementing hash-based CSP. No 'unsafe-inline' needed.

3. X-Content-Type-Options

What it does: Prevents MIME type sniffing. The browser trusts what you tell it, not what it guesses.

Without it: An attacker uploads a file with a .jpg extension containing JavaScript. Without this header, some browsers will execute it.

The fix:

X-Content-Type-Options: nosniff

One line. No configuration. Just add it.

4. X-Frame-Options

What it does: Prevents your page from being loaded in an iframe.

Without it: Clickjacking attacks. An attacker overlays your login page inside a transparent iframe on their site. Users click what they think is a harmless button — actually submitting credentials to your page.

The fix:

X-Frame-Options: DENY

Or SAMEORIGIN if you need to embed your own pages.

5. Referrer-Policy

What it does: Controls what URL information is sent in the Referer header when users navigate away from your page.

Without it: Session tokens in URLs get leaked to external sites. API keys in query parameters get sent to analytics services. Internal paths get exposed to third parties.

The fix:

Referrer-Policy: strict-origin-when-cross-origin

6. Permissions-Policy

What it does: Controls which browser features your page can use (camera, microphone, geolocation, etc.).

Without it: If an attacker injects code, they can access the user's camera, microphone, or location without additional prompts.

The fix:

Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=()

Explicitly deny everything you don't need.

7. X-XSS-Protection

What it does: Enables the browser's built-in XSS filter.

Note: Modern browsers are deprecating this in favor of CSP. But it's still worth including for older browsers and as defense-in-depth.

The fix:

X-XSS-Protection: 1; mode=block

🔍 Check Your Score in 30 Seconds

We built a free scanner. No signup, no data stored. Enter your URL, get an instant A-F grade.

Scan Your API Now →

Why This Matters for Fintech

If you're processing payments, handling PII, or operating under PSD2/PCI-DSS requirements:

Not having these headers isn't just a security risk — it's a compliance gap.

What a Grade A Looks Like

Our sites score 93/100 (Grade A)

Here's the full header set we use:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Security-Policy: default-src 'self'; script-src 'self' 'sha256-...'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
X-XSS-Protection: 1; mode=block

We practice what we preach. Scan our sites to verify.


Need a Full Audit?

The free scan covers headers and basic transport security. A full audit covers:

€3,500 · 10 business days · Fixed price
Learn More →

🛡️
ThreeStack Security Team
Three specialists building security tools for the API economy. We run free scans at scan.threestack.io and provide professional audits for companies that need deeper analysis.