6.5medium
github.com/gofiber/fiber/v3 cache middleware can mix responses across query parameters
- Severity
- 6.5medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.25% (higher than 17% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-35hp-hqmv-8qg8GO-2026-5069
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| gofiber fiber | >= v3.0.0-beta.2, < 3.1.0, up to 3.1.0 | CVE List, NVD |
| github.com/gofiber/fiber/v3 (Go) | before 3.2.0 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N |
Classification
What each source says
CVE List
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.
GitHub Advisory Database
Summary
Fiber cache middleware's default key generator uses only c.Path() and does not include the query string.
As a result, requests like /?id=1 and /?id=2 can map to the same cache key and share the same cached response.
This can cause response mix-up (cache poisoning-like behavior) for endpoints where response content depends on query parameters.
Details
Default configuration in cache middleware:
KeyGenerator: func(c fiber.Ctx) string { return utils.CopyString(c.Path()) }
References:
- https://github.com/gofiber/fiber/blob/main/middleware/cache/config.go#L90-L92
- https://github.com/gofiber/fiber/blob/main/middleware/cache/cache_test.go#L599-L621
The 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.
PoC
Minimal PoC:
package main
import (
"log"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/cache"
)
func main() {
app := fiber.New()
app.Use(cache.New()) // default config
app.Get("/", func(c fiber.Ctx) error {
return c.SendString(c.Query("id", "1"))
})
log.Fatal(app.Listen(":3000"))
}
Reproduction:
GET /?id=1- Cache miss
- Response body:
1
GET /?id=2- Cache hit
- Response body:
1(expected2)
Local verification command used:
go test ./middleware/cache -run Test_Cache_WithNoCacheRequestDirective -count=1
Observed result: test passes, confirming this is current behavior.
Impact
- Responses that should vary by query parameters can be mixed between requests.
- In real deployments, this may leak or corrupt user/tenant-specific content if query parameters influence context or data selection.
- This is deployment-dependent but security-relevant, and not safe-by-default for query-variant responses.
Suggested remediation
- Change default cache key generation to include path + normalized query string (or canonicalized original URL).
- Keep ability for custom key generators.
- Add explicit documentation warning that path-only keying is unsafe for query-dependent responses.
Go Vulnerability Database
Fiber: Cache middleware key generator ignores query string in github.com/gofiber/fiber
NVD (es)
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.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-30246 changed 2026-05-05 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-35hp-hqmv-8qg8 changed 2026-07-24 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-5069 changed 2026-07-24 | CC-BY-4.0 |
| NVD | CVE-2026-30246 changed 2026-10-26 | Public domain |