CVE-2025-54801: Github.com/gofiber/fiber/v2 Fiber Crashes Vulnerability

HIGH
Advisory Identifier: GHSA-qx2q-88mx-vhg7
CWE-789
Published
Advisory Summary

CVE-2025-54801 is a HIGH fiber crashes vulnerability (CWE-789: Memory Allocation with Excessive Size Value) affecting Github.com/gofiber/fiber/v2 libraries in the Go ecosystem. The issue involves fiber crashes in bodyparser due to unvalidated large slice index in decoder. Remediation is available by upgrading affected packages to version 2.52.9.

CVE-2025-54801 at a Glance

CVE Identifier CVE-2025-54801
GHSA Identifier GHSA-qx2q-88mx-vhg7
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-789: Memory Allocation with Excessive Size Value
Affected Product Github.com/gofiber/fiber/v2
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2025-54801

To remediate this vulnerability, upgrade all affected Github.com/gofiber/fiber/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/gofiber/fiber/v2 fixed: 2.52.9
Upgrade github.com/gofiber/fiber/v2 to 2.52.9
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/gofiber/fiber/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-54801, inspect your project dependencies for Github.com/gofiber/fiber/v2:

inspect dependencies for github.com/gofiber/fiber/v2

Analyze the terminal output to locate any version of Github.com/gofiber/fiber/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.52.9), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-789: Memory Allocation with Excessive Size Value, where the product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated. In Github.com/gofiber/fiber/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Description When using Fiber's `Ctx.BodyParser` to parse form data containing a large numeric key that represents a slice index (e.g., `test.18446744073704`), the application crashes due to an out-of-bounds slice allocation in the underlying schema decoder. The root cause is that the decoder attempts to allocate a slice of length `idx + 1` without validating whether the index is within a safe or reasonable range. If `idx` is excessively large, this leads to an integer overflow or memory exhaustion, causing a panic or crash. ### Steps to Reproduce Create a POST request handler that accepts `x-www-form-urlencoded` data ```go package main import ( "fmt" "net/http" "github.com/gofiber/fiber/v2" ) type RequestBody struct { NestedContent []*struct{} `form:"test"` } func main() { app := fiber.New() app.Post("/", func(c *fiber.Ctx) error { formData := RequestBody{} if err := c.BodyParser(&formData); err != nil { fmt.Println(err) return c.SendStatus(http.StatusUnprocessableEntity) } return nil }) fmt.Println(app.Listen(":3000")) } ``` Run the server and send a POST request with a large numeric key in form data, such as: ```bash curl -v -X POST localhost:3000 --data-raw 'test.18446744073704' \ -H 'Content-Type: application/x-www-form-urlencoded' ``` ### Relevant Code Snippet Within the decoder's [decode method](https://github.com/gofiber/fiber/blob/v2.52.8/internal/schema/decoder.go#L249): ```go idx := parts[0].index if v.IsNil() || v.Len() < idx+1 { value := reflect.MakeSlice(t, idx+1, idx+1) // <-- Panic/crash occurs here when idx is huge if v.Len() < idx+1 { reflect.Copy(value, v) } v.Set(value) } ``` The `idx` is not validated before use, leading to unsafe slice allocation for extremely large values. --- ### Impact - Application panic or crash on malicious or malformed input. - Potential denial of service (DoS) via memory exhaustion or server crash. - Lack of defensive checks in the parsing code causes instability.

CVE-2025-54801 Affected Github.com/gofiber/fiber/v2 Versions

1 component(s)
Fixed Versions:
2.52.9
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gofiber/fiber/v2
Go
< 2.52.9
2.52.9

References

Frequently Asked Questions

What is CVE-2025-54801?
CVE-2025-54801 is a security vulnerability in Github.com/gofiber/fiber/v2 involving Fiber Crashes in BodyParser Due to Unvalidated Large Slice Index in Decoder under CWE-789: Memory Allocation with Excessive Size Value.
Which Github.com/gofiber/fiber/v2 versions are affected?
Affected versions include releases prior to 2.52.9 across affected packages: github.com/gofiber/fiber/v2.
What version fixes CVE-2025-54801?
Upgrading to 2.52.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gofiber/fiber/v2 affected?
Yes, github.com/gofiber/fiber/v2 is affected in releases prior to 2.52.9. Upgrade your dependency to 2.52.9 or later.
What CWE is associated with CVE-2025-54801?
CVE-2025-54801 is classified under CWE-789: Memory Allocation with Excessive Size Value (The product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated.).
How can I check Go dependencies for CVE-2025-54801?
Run the dependency tree command: 'inspect dependencies for github.com/gofiber/fiber/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qx2q-88mx-vhg7",
  "modified" : "2025-08-06T14:31:40Z",
  "published" : "2025-08-05T15:22:21Z",
  "aliases" : [ "CVE-2025-54801" ],
  "summary" : "Fiber Crashes in BodyParser Due to Unvalidated Large Slice Index in Decoder",
  "details" : "### Description\n\nWhen using Fiber's `Ctx.BodyParser` to parse form data containing a large numeric key that represents a slice index (e.g., `test.18446744073704`), the application crashes due to an out-of-bounds slice allocation in the underlying schema decoder.\n\nThe root cause is that the decoder attempts to allocate a slice of length `idx + 1` without validating whether the index is within a safe or reasonable range. If `idx` is excessively large, this leads to an integer overflow or memory exhaustion, causing a panic or crash.\n\n\n### Steps to Reproduce\n\nCreate a POST request handler that accepts `x-www-form-urlencoded` data\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/gofiber/fiber/v2\"\n)\n\ntype RequestBody struct {\n\tNestedContent []*struct{} `form:\"test\"`\n}\n\nfunc main() {\n\tapp := fiber.New()\n\n\tapp.Post(\"/\", func(c *fiber.Ctx) error {\n\t\tformData := RequestBody{}\n\t\tif err := c.BodyParser(&formData); err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn c.SendStatus(http.StatusUnprocessableEntity)\n\t\t}\n\t\treturn nil\n\t})\n\n\tfmt.Println(app.Listen(\":3000\"))\n}\n\n```\n\nRun the server and send a POST request with a large numeric key in form data, such as:\n\n```bash\ncurl -v -X POST localhost:3000 --data-raw 'test.18446744073704' \\\n  -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n\n### Relevant Code Snippet\n\nWithin the decoder's [decode method](https://github.com/gofiber/fiber/blob/v2.52.8/internal/schema/decoder.go#L249):\n\n```go\nidx := parts[0].index\nif v.IsNil() || v.Len() < idx+1 {\n    value := reflect.MakeSlice(t, idx+1, idx+1)  // <-- Panic/crash occurs here when idx is huge\n    if v.Len() < idx+1 {\n        reflect.Copy(value, v)\n    }\n    v.Set(value)\n}\n```\n\nThe `idx` is not validated before use, leading to unsafe slice allocation for extremely large values.\n\n---\n\n### Impact\n\n- Application panic or crash on malicious or malformed input.\n- Potential denial of service (DoS) via memory exhaustion or server crash.\n- Lack of defensive checks in the parsing code causes instability.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gofiber/fiber/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.52.9"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.52.8"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/fiber/security/advisories/GHSA-qx2q-88mx-vhg7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-54801"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/fiber/commit/e115c08b8f059a4a031b492aa9eef0712411853d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gofiber/fiber"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-789" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-05T15:22:21Z",
    "nvd_published_at" : "2025-08-06T00:15:31Z"
  }
}