Sphere
Log in Join
☆ 10

CORS misconfiguration letting any origin through

a pentest found our API reflects the Origin header into Access-Control-Allow-Origin and sets Access-Control-Allow-Credentials: true. so any site can make credentialed requests. this is a real vuln right? what's the correct fix for a SPA on a different domain?

⚑ Report

4 replies

☆ 0
D duct ·2026-10-29#1

yes, that's a real CSRF-equivalent vuln. reflecting arbitrary origins with credentials means any attacker site can read authenticated responses. fix: maintain an allowlist of trusted origins and only echo those, never * with credentials.

⚑ Report
☆ 0
R rose ·2026-11-01#2

our frontend is at app.example.com and API at api.example.com. so allowlist just those two? what about local dev on localhost:3000?

⚑ Report
☆ 0
Z zombie ·2026-11-02#3

allowlist exact origins including scheme and port: https://app.example.com, http://localhost:3000 for dev. don't use suffix/prefix matching (attackers register example.com.evil.com). make the allowlist environment-specific.

⚑ Report
☆ 0
R regex ·2026-11-06#4

implemented an exact-match allowlist, dropped reflection, kept credentials true only for trusted origins. pentest recheck passed. also added Vary: Origin so caches don't serve the wrong header.

⚑ Report
Log in to reply.