Loading...
Skip to main content

CVE-2024-25124 — Vulnerability in github.com/gofiber/fiber/v2 —...

CRITICAL

Fiber has Insecure CORS Configuration, Allowing Wildcard Origin with Credentials

Published February 22, 2024Updated September 10, 2026Source: osv

Summary

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](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSNotSupportingCredentials) [CodeQL on CORS Misconfiguration](https://codeql.github.com/codeql-query-help/javascript/js-cors-misconfiguration-for-credentials/) [PortSwigger on Exploiting CORS Misconfigurations](http://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html) [WhatWG CORS protocol and credentials ](https://fetch.spec.whatwg.org/#cors-protocol-and-credentials)

Advisory Timeline

  • First published February 22, 2024 (963 days ago).
  • Last revised September 10, 2026 — 930 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Go
Update github.com/gofiber/fiber/v2 to 2.52.1 or later
go get github.com/gofiber/fiber/v2@v2.52.1

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: go (1).

PackageEcosystemAffectedFixed In
github.com/gofiber/fiber/v2
go
All versions2.52.1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-346
    Origin Validation ErrorMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.4 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
Low

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L

Frequently Asked Questions

What is CVE-2024-25124?
Fiber has Insecure CORS Configuration, Allowing Wildcard Origin with Credentials This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.4/10).
How do I check if my project is affected by CVE-2024-25124?
CVE-2024-25124 affects github.com/gofiber/fiber/v2. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-25124 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.4

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-fmg4-x8pw-hjhg
GO-2024-2574

Related CVEs

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies