Micronaut filters and route arguments can see different values for the same request (form charset, path variable precedence)
Description
A client-chosen charset on an application/x-www-form-urlencoded body makes FilterBodyParser and @Body form binding decode different field sets from the same bytes, so a filter that checks a field approves a request whose route binds another value. In addition, a URI path variable silently overrides an explicitly annotated @RequestAttribute, @Header or @CookieValue argument with the same name, so a value that a filter set as a request attribute (for example the authenticated tenant) is replaced by the client's path segment. Applications that make authorisation decisions in filters on these values can be bypassed. The fix is to decode form bodies once with one charset decision shared by filters and binders, and to let explicit binding annotations take precedence over URI variables.
Affected and patched versions
URI-variable precedence (F54, micronaut-router) predates 3.0.0. FilterBodyParser (F20, micronaut-http-server) was introduced in 4.8.0.
| Package | Affected versions | Patched version |
|---|---|---|
io.micronaut:micronaut-router | < 3.10.19 | 3.10.19 |
io.micronaut:micronaut-router | >= 4.0.0, < 4.10.37 | 4.10.37 |
io.micronaut:micronaut-router | >= 5.0.0, < 5.2.23 | 5.2.23 |
io.micronaut:micronaut-http-server | >= 4.8.0, < 4.10.37 | 4.10.37 |
io.micronaut:micronaut-http-server | >= 5.0.0, < 5.2.23 | 5.2.23 |
The 3.x fix is in commit 62e4f9eb54, first included in stable release 3.10.19. The last affected stable 3.10.x release is 3.10.18.
Findings
- F20 (= ANT-2026-RAW04XDN)
- F54