Описание
Fiber panics when fiber.Ctx.BodyParser parses invalid range index
Summary
When using the fiber.Ctx.BodyParser to parse into a struct with range values, a panic occurs when trying to parse a negative range index
Details
fiber.Ctx.BodyParser can map flat data to nested slices using key[idx]value syntax, however when idx is negative, it causes a panic instead of returning an error stating it cannot process the data.
Since this data is user-provided, this could lead to denial of service for anyone relying on this fiber.Ctx.BodyParser functionality
Reproducing
Take a simple GoFiberV2 server which returns a JSON encoded version of the FormData
Correct Behaviour Send a valid request such as:
You recieve valid JSON
Crashing behaviour Send an invalid request such as:
The server panics and crashes
Impact
Anyone using fiber.Ctx.BodyParser can/will have their servers crashed when an invalid payload is sent
Пакеты
github.com/gofiber/fiber/v2
>= 2.52.6, < 2.52.7
2.52.7
Связанные уязвимости
Fiber is an Express-inspired web framework written in Go. Starting in version 2.52.6 and prior to version 2.52.7, `fiber.Ctx.BodyParser` can map flat data to nested slices using `key[idx]value` syntax, but when idx is negative, it causes a panic instead of returning an error stating it cannot process the data. Since this data is user-provided, this could lead to denial of service for anyone relying on this `fiber.Ctx.BodyParser` functionality. Version 2.52.7 fixes the issue.