{"schema_version":"1.7.3","id":"GHSA-qx2q-88mx-vhg7","published":"2025-08-05T15:22:21Z","modified":"2026-02-04T04:21:12.696581Z","aliases":["CVE-2025-54801","GO-2025-3845"],"related":["CGA-vp7x-3q95-x4wq"],"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.","affected":[{"package":{"name":"github.com/gofiber/fiber/v2","ecosystem":"Go","purl":"pkg:golang/github.com/gofiber/fiber/v2"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"2.52.9"}]}],"database_specific":{"last_known_affected_version_range":"<= 2.52.8","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/08/GHSA-qx2q-88mx-vhg7/GHSA-qx2q-88mx-vhg7.json"}}],"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"],"github_reviewed":true,"github_reviewed_at":"2025-08-05T15:22:21Z","nvd_published_at":"2025-08-06T00:15:31Z","severity":"HIGH"},"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"}]}