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.
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.
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.
CVE-2026-30246 has a CVSS score of 6.5 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (3.2.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-30246? CVE-2026-30246 is a medium-severity security vulnerability in github.com/gofiber/fiber/v3 (go), affecting versions <= 3.1.0. It is fixed in 3.2.0.
- How severe is CVE-2026-30246? CVE-2026-30246 has a CVSS score of 6.5 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/gofiber/fiber/v3 are affected by CVE-2026-30246? github.com/gofiber/fiber/v3 (go) versions <= 3.1.0 is affected.
- Is there a fix for CVE-2026-30246? Yes. CVE-2026-30246 is fixed in 3.2.0. Upgrade to this version or later.
- Is CVE-2026-30246 exploitable, and should I be worried? Whether CVE-2026-30246 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-30246 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-30246? Upgrade
github.com/gofiber/fiber/v3to 3.2.0 or later.