CVE-2024-25124: Fiber has Insecure CORS Configuration, Allowing Wildcard Origin with Credentials

Published Feb 21, 2024
·
Updated

Fiber is a web framework written in go. Prior to version 2.52.1, the CORS middleware allows for insecure configurations that could potentially expose the application to multiple CORS-related vulnerabilities. Specifically, it allows setting the Access-Control-Allow-Origin header to a wildcard () while also having the Access-Control-Allow-Credentials set to true, which goes against recommended security best practices. The impact of this misconfiguration is high as it can lead to unauthorized access to sensitive user data and expose the system to various types of attacks listed in the PortSwigger article linked in the references. Version 2.52.1 contains a patch for this issue. As a workaround, users may manually validate the CORS configurations in their implementation to ensure that they do not allow a wildcard origin when credentials are enabled. The browser fetch api, as well as browsers and utilities that enforce CORS policies, are not affected by this.

Other sources

The CORS middleware allows for insecure configurations that could potentially expose the application to multiple CORS-related vulnerabilities. Specifically, it allows setting the Access-Control-Allow-Origin header to a wildcard ("") while also having the Access-Control-Allow-Credentials set to true, which goes against recommended security best practices.

Impact The impact of this misconfiguration is high as it can lead to unauthorized access to sensitive user data and expose the system to various types of attacks listed in the PortSwigger article linked in the references.

Proof of Concept The code in cors.go allows setting a wildcard in the AllowOrigins while having AllowCredentials set to true, which could lead to various vulnerabilities.

Potential Solution Here is a potential solution to ensure the CORS configuration is secure:

go func New(config ...Config) fiber.Handler { if cfg.AllowCredentials && cfg.AllowOrigins == "" { panic("[CORS] Insecure setup, 'AllowCredentials' is set to true, and 'AllowOrigins' is set to a wildcard.") } // Return new handler goes below }

The middleware will not allow insecure configurations when using AllowCredentials and AllowOrigins.

Workarounds For the meantime, users are advised to manually validate the CORS configurations in their implementation to ensure that they do not allow a wildcard origin when credentials are enabled. The browser fetch api, browsers and utilities that enforce CORS policies are not affected by this.

References MDN Web Docs on CORS Errors CodeQL on CORS Misconfiguration PortSwigger on Exploiting CORS Misconfigurations WhatWG CORS protocol and credentials

GitHub

Affected Software

2 affected componentsFixes available
go/github.com/gofiber/fiber/v2<2.52.1
2.52.1
gofiber Fiber Go<2.52.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/gofiber/fiber/v2 to a version that resolves this vulnerability.

    Fixed in 2.52.1
  2. Upgrade

    Upgrade Fiber CORS middleware to a version that resolves this vulnerability.

    Fixed in 2.52.1
  3. Configuration

    If using Fiber’s CORS middleware, manually validate/change your CORS configuration so that when `AllowCredentials` is enabled, `AllowOrigins` is not set to the wildcard `"*"` (since wildcard origin with credentials is insecure).

    Fiber (CORS middleware) AllowOrigins = not "*" when AllowCredentials is true

Event History

Feb 21, 2024
CVE Published
via MITRE·09:01 PM
Data Sourced
via MITRE·09:01 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:15 PM
RemedyAffected Software
Feb 22, 2024
Advisory Published
via GitHub·06:25 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-25124?

CVE-2024-25124 has a moderate severity level due to its potential to enable multiple CORS-related vulnerabilities.

2

How do I fix CVE-2024-25124?

To fix CVE-2024-25124, upgrade to Fiber version 2.52.1 or later.

3

What are the potential risks of CVE-2024-25124?

The risks include exposure to cross-origin resource sharing vulnerabilities, which can lead to unauthorized access to sensitive data.

4

Which versions of Fiber are affected by CVE-2024-25124?

CVE-2024-25124 affects Fiber versions prior to 2.52.1.

5

What is the recommended action for users of Fiber regarding CVE-2024-25124?

Users of Fiber are recommended to immediately update to version 2.52.1 or later to mitigate the vulnerability.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203