Medium severityC#Insecure ConfigurationHIGH confidence
CORS Reflect Any Origin
A CORS policy reflects any request origin via SetIsOriginAllowed(_ => true), effectively allowing all sites and defeating the same-origin protections CORS is meant to enforce (CWE-942).
Standards mapping
- OWASP Top 10
- A05:2021 - Security Misconfiguration
- OWASP ASVS
- V14.5.3 (L1)
Vulnerable vs. safe
Flagged by this check
builder.SetIsOriginAllowed(origin => true);Passes - the safe pattern
builder.SetIsOriginAllowed(origin => origin == "https://app.example.com");Why it matters & how to fix it
A CORS policy reflects any request origin via SetIsOriginAllowed(_ => true), effectively allowing all sites and defeating the same-origin protections CORS is meant to enforce (CWE-942). Return true only for origins on an explicit allow-list, or use WithOrigins(...) with fixed hostnames.
References
Rule ID integsec.csharp.insecure-config.cors-reflect-any-origin - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - Insecure ConfigurationCORS Acao Wildcard Header
- JavaScript / TypeScript - Insecure ConfigurationCORS Wildcard Origin
- JavaScript / TypeScript - Insecure ConfigurationCORS Wildcard With Credentials
- JavaScript / TypeScript - Insecure ConfigurationCSRF Protection Disabled
- JavaScript / TypeScript - Insecure ConfigurationExpress Trust Proxy All
- JavaScript / TypeScript - Insecure ConfigurationExpress X Powered By Enabled