agentleFS
mahumadadmahumadad/quarry/skills/core/http-headers/SKILL.md

http-headers-security

Skill1 starsChanged 10 days agoMITView on GitHub

Audit HTTP security headers on every in-scope web endpoint. Covers CSP, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, COOP, COEP, CORP, Cache-Control (sensitive pages), and deprecated/redundant headers (X-XSS-Protection). Run after tech fingerprinting and before xss/clickjacking — missing headers widen the attack surface for those vulns.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After identifying the tech stack — some headers are framework-specific.

    line 22
  2. Distinctive:

    When building the attack surface for XSS, clickjacking, or CSRF.

    line 23
  3. Distinctive:

    Check: camera, microphone, geolocation, payment, usb

    line 94
  4. Distinctive:

    Remove or genericize in production

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Signals

  • Any web endpoint in scope (HTML pages, API endpoints, login/logout flows).
  • After identifying the tech stack — some headers are framework-specific.
  • When building the attack surface for XSS, clickjacking, or CSRF.

Prerequisites

  • List of in-scope URLs (at least: homepage, login, authenticated page, API base).
  • Tech stack fingerprint (framework defaults differ).

Methodology

1. Collect headers from key pages

# Grab headers from multiple representative pages
for url in "$TARGET" "$TARGET/login" "$TARGET/api/v1" "$TARGET/dashboard"; do
  echo "=== $url ==="
  curl -sI -o /dev/null -D - "$url" 2>/dev/null | grep -iE "^(strict|content-sec|x-frame|x-content|referrer|permissions|cross-origin|cache-control|x-xss|set-cookie|server|x-powered)"
  echo
done

2. Check each header

Content-Security-Policy (CSP)

curl -sI "$TARGET" | grep -i "content-security-policy"
  • Missing entirely → Medium (enables XSS exploitation)
  • unsafe-inline in script-src → weakens CSP significantly
  • unsafe-eval in script-src → allows eval-based XSS
  • * or overly broad domains in script-src → 3rd party injection
  • No frame-ancestors → clickjacking (if X-Frame-Options also absent)
  • report-uri / report-to present → note for evasion awareness

Strict-Transport-Security (HSTS)

curl -sI "https://$TARGET" | grep -i "strict-transport-security"
  • Missing → Medium (SSL stripping possible)
  • max-age < 31536000 (1 year) → Low (short HSTS window)
  • No includeSubDomains → subdomains vulnerable to stripping
  • No preload → not in browser preload list (informational)
  • Present on HTTP (not HTTPS) → misconfiguration, browser ignores it

X-Frame-Options

curl -sI "$TARGET" | grep -i "x-frame-options"
  • Missing (and no CSP frame-ancestors) → Medium (clickjacking)
  • ALLOW-FROM → deprecated, not supported by modern browsers
  • SAMEORIGIN or DENY → correct

X-Content-Type-Options

curl -sI "$TARGET" | grep -i "x-content-type-options"
  • Missing → Low (MIME-sniffing attacks)
  • Expected: nosniff

Referrer-Policy

curl -sI "$TARGET" | grep -i "referrer-policy"
  • Missing → Low (tokens/sensitive paths leaked in Referer header)
  • unsafe-url or no-referrer-when-downgrade → leaks full URL
  • strict-origin-when-cross-origin or no-referrer → correct

Permissions-Policy (formerly Feature-Policy)

curl -sI "$TARGET" | grep -iE "permissions-policy|feature-policy"
  • Missing → Informational (browser features unrestricted)
  • Check: camera, microphone, geolocation, payment, usb

Cross-Origin headers (COOP/COEP/CORP)

curl -sI "$TARGET" | grep -i "cross-origin"
  • Cross-Origin-Opener-Policy → protects against Spectre-like leaks
  • Cross-Origin-Embedder-Policy → required for SharedArrayBuffer
  • Cross-Origin-Resource-Policy → prevents cross-origin reads

Cache-Control on sensitive pages

curl -sI "$TARGET/dashboard" | grep -i "cache-control"
curl -sI "$TARGET/api/v1/user/profile" | grep -i "cache-control"
  • Sensitive pages without no-store → Medium (cached credentials/PII)
  • API responses with PII without private, no-store → Medium

Set-Cookie flags

curl -sI "$TARGET/login" -X POST -d "user=test&pass=test" | grep -i "set-cookie"
  • Missing Secure flag → cookie sent over HTTP
  • Missing HttpOnly flag → cookie accessible to JS (XSS → session theft)
  • Missing SameSite → CSRF vector (unless CSRF tokens used)
  • SameSite=None without Secure → browser rejects it

Information leakage headers

curl -sI "$TARGET" | grep -iE "^(server|x-powered-by|x-aspnet|x-generator)"
  • Server: Apache/2.4.51 → version disclosure
  • X-Powered-By: PHP/8.1.2 → version disclosure
  • Remove or genericize in production

3. Batch check with httpx (fast)

echo "$TARGET" | httpx -silent -status-code -title \
  -H "Strict-Transport-Security" \
  -H "Content-Security-Policy" \
  -H "X-Frame-Options" \
  -H "X-Content-Type-Options" \
  -json -o headers-audit.json

4. Automated check with securityheaders.com

# Quick reference — compare against manual findings
curl -s "https://securityheaders.com/?q=$TARGET&followRedirects=on" \
  | grep -oP 'class="[A-F](-\w+)?"' | head -1

5. Nuclei scan for header misconfigurations

nuclei -u "$TARGET" -t http/misconfiguration/ \
  -t http/exposed-panels/ \
  -tags header,security-headers,misconfig \
  -json -o nuclei-headers.json

Severity Mapping

Missing/MisconfiguredSeverityCondition
CSP missing entirelyMediumEspecially if XSS found
CSP with unsafe-inline + unsafe-evalLow-MediumWeakens but not absent
HSTS missingMediumHTTPS available but no HSTS
X-Frame-Options + CSP frame-ancestors both missingMediumClickjacking possible
X-Content-Type-Options missingLow
Set-Cookie without Secure/HttpOnlyMediumOn session cookies
Set-Cookie SameSite=NoneLow-MediumWithout CSRF tokens
Cache-Control missing on sensitive pagesMediumPages with PII/auth
Referrer-Policy missing/unsafeLow
Permissions-Policy missingInformational
Server/X-Powered-By version disclosureInformational
COOP/COEP/CORP missingInformationalUnless Spectre-class concern

Validation Gate

  • Headers collected from at least: homepage, login, one authenticated page, one API endpoint.
  • Each header checked individually — not just a single automated scan grade.
  • Missing headers that enable other attacks (CSP → XSS, X-Frame-Options → clickjacking) cross-referenced with those hunt skills.
  • Set-Cookie flags checked on actual session cookies, not just any cookie.
  • Cache-Control checked specifically on pages containing PII or auth tokens.

Gotchas

  • A grade from securityheaders.com is not a finding — it's a starting point. Report specific missing headers with specific impact.
  • CSP report-only mode does not actually block anything — it's monitoring only.
  • X-XSS-Protection is deprecated and can actually introduce vulnerabilities in some browsers (filter-based XSS). Don't recommend enabling it; if present, note as informational.
  • Some frameworks set headers by default (Django's SecurityMiddleware, Rails' default_headers) — check if they're being overridden or stripped by a reverse proxy.
  • API-only endpoints may legitimately skip some headers (X-Frame-Options irrelevant for JSON APIs).
  • CDN/reverse proxy (Cloudflare, nginx) may add or strip headers — test against the origin if possible.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.