{"id":"CVE-2026-30246","aliases":["CVE-2026-30246","GHSA-35hp-hqmv-8qg8","GO-2026-5069"],"related":[],"kind":"vulnerability","state":"published","title":"github.com/gofiber/fiber/v3 cache middleware can mix responses across query parameters","summary":"Fiber is a web framework for Go. In github.com/gofiber/fiber/v3 versions through 3.1.0, the default key generator in the cache middleware uses only the request path and does not include the query string. As a result, requests for the same path with different query parameters can share a cache key and receive the wrong cached response. This can cause response mix-up for query-dependent endpoints and may expose data intended for a different request. This issue is fixed after version 3.1.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Fiber is a web framework for Go. In github.com/gofiber/fiber/v3 versions through 3.1.0, the default key generator in the cache middleware uses only the request path and does not include the query string. As a result, requests for the same path with different query parameters can share a cache key and receive the wrong cached response. This can cause response mix-up for query-dependent endpoints and may expose data intended for a different request. This issue is fixed after version 3.1.0.","source":"cvelist"},{"lang":"en","text":"### Summary\nFiber cache middleware's default key generator uses only `c.Path()` and does not include the query string.\nAs a result, requests like `/?id=1` and `/?id=2` can map to the same cache key and share the same cached response.\n\nThis can cause response mix-up (cache poisoning-like behavior) for endpoints where response content depends on query parameters.\n\n### Details\nDefault configuration in cache middleware:\n\n- `KeyGenerator: func(c fiber.Ctx) string { return utils.CopyString(c.Path()) }`\n\nReferences:\n- https://github.com/gofiber/fiber/blob/main/middleware/cache/config.go#L90-L92\n- https://github.com/gofiber/fiber/blob/main/middleware/cache/cache_test.go#L599-L621\n\nThe existing test demonstrates that when handler output depends on query parameter `id`, a second request with a different query still returns the first cached response (cache hit), confirming query is not part of the default cache key.\n\n### PoC\nMinimal PoC:\n\n```go\npackage main\n\nimport (\n    \"log\"\n\n    \"github.com/gofiber/fiber/v3\"\n    \"github.com/gofiber/fiber/v3/middleware/cache\"\n)\n\nfunc main() {\n    app := fiber.New()\n    app.Use(cache.New()) // default config\n\n    app.Get(\"/\", func(c fiber.Ctx) error {\n        return c.SendString(c.Query(\"id\", \"1\"))\n    })\n\n    log.Fatal(app.Listen(\":3000\"))\n}\n```\n\nReproduction:\n\n1. `GET /?id=1`\n   - Cache miss\n   - Response body: `1`\n2. `GET /?id=2`\n   - Cache hit\n   - Response body: `1` (expected `2`)\n\nLocal verification command used:\n\n```bash\ngo test ./middleware/cache -run Test_Cache_WithNoCacheRequestDirective -count=1\n```\n\nObserved result: test passes, confirming this is current behavior.\n\n### Impact\n- Responses that should vary by query parameters can be mixed between requests.\n- In real deployments, this may leak or corrupt user/tenant-specific content if query parameters influence context or data selection.\n- This is deployment-dependent but security-relevant, and not safe-by-default for query-variant responses.\n\n### Suggested remediation\n- Change default cache key generation to include path + normalized query string (or canonicalized original URL).\n- Keep ability for custom key generators.\n- Add explicit documentation warning that path-only keying is unsafe for query-dependent responses.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Fiber: Cache middleware key generator ignores query string in github.com/gofiber/fiber","format":"markdown","source":"go"},{"lang":"es","text":"Fiber es un web framework para Go. En las versiones de github.com/gofiber/fiber/v3 hasta la 3.1.0, el generador de claves predeterminado en el middleware de caché utiliza solo la ruta de la solicitud y no incluye la cadena de consulta. Como resultado, las solicitudes para la misma ruta con diferentes parámetros de consulta pueden compartir una clave de caché y recibir la respuesta en caché incorrecta. Esto puede causar una mezcla de respuestas para endpoints dependientes de la consulta y puede exponer datos destinados a una solicitud diferente. Este problema se soluciona después de la versión 3.1.0.","source":"nvd"}],"published":"2026-04-28T22:28:14.000Z","modified":"2026-10-26T19:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-200","CWE-436","CWE-524"],"affected":[{"ranges":[{"version":">= v3.0.0-beta.2, < 3.1.0","status":"affected"}],"vendor":"gofiber","product":"fiber","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.2.0"}],"ecosystem":"Go","package":"github.com/gofiber/fiber/v3","purl":"pkg:golang/github.com/gofiber/fiber/v3","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.2.0"}],"ecosystem":"Go","package":"github.com/gofiber/fiber/v3","purl":"pkg:golang/github.com/gofiber/fiber/v3","source":"go"},{"ranges":[{"status":"affected","lastAffected":"3.1.0"}],"vendor":"gofiber","product":"fiber","cpe":"cpe:2.3:a:gofiber:fiber:*:*:*:*:*:go:*:*","source":"nvd"}],"references":[{"url":"https://github.com/gofiber/fiber/security/advisories/GHSA-35hp-hqmv-8qg8","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/gofiber/fiber/blob/main/middleware/cache/cache_test.go#L599-L621","tags":["product","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/gofiber/fiber/blob/main/middleware/cache/config.go#L90-L92","tags":["product","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-30246","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gofiber/fiber/commit/050ff1ff18511c1475b8ec627460216aaecddd4e","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/gofiber/fiber/commit/9a0d12c07ed895b84c72987f9288b04137afe5de","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/gofiber/fiber","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-05-05T15:03:58.218Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-30246","url":"https://www.cve.org/CVERecord?id=CVE-2026-30246","licence":"CVE Terms of Use","modified":"2026-05-05T15:04:02.984Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-35hp-hqmv-8qg8","url":"https://github.com/advisories/GHSA-35hp-hqmv-8qg8","licence":"CC-BY-4.0","modified":"2026-07-24T19:11:27.190Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5069","url":"https://pkg.go.dev/vuln/GO-2026-5069","licence":"CC-BY-4.0","modified":"2026-07-24T19:00:21.464Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-30246","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-30246","licence":"Public domain","modified":"2026-10-26T19:10:00.163Z"}],"updatedAt":"2026-11-25T22:59:20.601Z","epss":{"score":0.00251,"percentile":0.17672,"date":"2026-12-01T12:00:22.000Z"}}