BERRY9 IT SERVICES

CORS Misconfigurations: Testing Origin Reflection & Leaks

How Cross-Origin Resource Sharing (CORS) misconfigurations expose authenticated API data, how testers prove exploitability, and safe origin allowlisting.

Web & App Security · By Thimmagurudu Bathini, CTO · Published · 5 min read

CORS Misconfigurations: Testing Origin Reflection & Leaks architecture and testing overview

When a Permissive CORS Header Becomes Exploitable

Misconfigured CORS headers allow malicious third-party websites to read sensitive responses from your authenticated APIs in a victim's browser. While automated tools flag any wildcard header, manual testers check whether Access-Control-Allow-Credentials: true pairs with reflected origins, null origins, or weak regex allowlists.

curl -i -s https://api.example.com/v1/me \
  -H "Origin: https://attacker.example"
# Vulnerable if response includes BOTH:
# Access-Control-Allow-Origin: https://attacker.example
# Access-Control-Allow-Credentials: true

Comparing Wildcard, Reflected & Null Origins

CORS header patterns and real exploitability
Header PatternExploitable?Why It Matters
Origin: * without credentialsUsually Low / InfoPublic non-authenticated data only; browsers block credentialed wildcard
Reflected Origin + Credentials: trueHigh / CriticalAny website can read authenticated user PII or tokens via fetch()
Null Origin + Credentials: trueHighSandboxed iframe can forge Origin: null and exfiltrate data
Prefix/Suffix Regex BypassHighDomains like evilberry9.com or berry9.com.attacker.com pass weak regex

Building a Credentialed Cross-Origin PoC

  • Send custom Origin headers (arbitrary domain, null, subdomain prefix/suffix) to sensitive authenticated endpoints.
  • Verify whether Access-Control-Allow-Credentials: true is returned alongside the reflected Origin.
  • Build a working cross-origin HTML proof-of-concept demonstrating actual data read rather than reporting header presence alone.
  • Check Vary: Origin header presence to prevent web-cache poisoning across origins.

Writing an Exact-Match Origin Allowlist

Replace dynamic origin reflection and wildcard regexes with an exact-match allowlist of trusted HTTPS origins and always include Vary: Origin.

Eliminate scanner noise and verify real cross-origin risks with manual web and API testing. Request a scoped proposal →

CORS Security Testing Questions

Is Access-Control-Allow-Origin: * always a vulnerability?

No. On genuinely public, unauthenticated static or open APIs without credentials, wildcard CORS is safe and intentional.

How does BERRY9 verify CORS findings?

Our engineers test credentialed cross-origin data reads manually and provide a clean PoC—eliminating false positives.