Json Yaml Cors Wildcard Origin
Description
Detects insecure CORS (Cross-Origin Resource Sharing) configurations in AWS API Gateway resources defined in CloudFormation templates. The vulnerability occurs when CORS headers are configured to allow all origins (*), which may enable unauthorized cross-origin requests and expose the API to potential security risks.
Detection Strategy
• Check CloudFormation template files for API Gateway resource definitions
• Look for CORS configuration settings within API Gateway resources
• Flag resources that use wildcard (*) in the Access-Control-Allow-Origin header
• Report a vulnerability when unrestricted CORS origins are found in the API Gateway configuration
Vulnerable code example
AWSTemplateFormatVersion: "2010-09-09"
Resources:
ApiMethod:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: OPTIONS
AuthorizationType: NONE # Vulnerable: No authentication required
Integration:...✅ Secure code example
AWSTemplateFormatVersion: "2010-09-09"
Resources:
ApiMethod:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: OPTIONS
AuthorizationType: IAM # Fixed: Require AWS IAM authentication
Integration:...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.