REDHAT-BUG-2553587: High severity go/github.com/getkin/kin-openapi vulnerability
kin-openapi is a Go project for handling OpenAPI files. From 0.144.0 until 0.147.0, openapi3filter.ValidationHandler validates an operation selected from decoded URL.Path while a downstream gorilla/mux router configured with UseEncodedPath can dispatch a different operation selected from URL.RawPath. When a public exact route and a protected parameterized route use the same method and overlap after decoding, an unauthenticated remote request containing an encoded path separator can be validated as public and then dispatched to the protected handler without invoking the configured AuthenticationFunc. The reachable path parameter is constrained to an encoded representation that decodes to the public literal route, and proxies that canonicalize the URI before forwarding prevent this specific mismatch. This issue is fixed in version 0.147.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 0.147.0
Event History
Frequently Asked Questions
Which deployments are exposed to authentication bypass?
Deployments are exposed when they use kin-openapi versions from 0.144.0 before 0.147.0 with openapi3filter.ValidationHandler and a downstream gorilla/mux router configured with UseEncodedPath. The application must also have overlapping public exact and protected parameterized routes using the same HTTP method.
What does an attacker need to exploit this issue?
An unauthenticated remote attacker needs to send a request containing an encoded path separator. The encoded path must decode to the public literal route while the router dispatches the raw encoded path to the protected parameterized route.
Are deployments behind a proxy necessarily affected?
No. Proxies that canonicalize the URI before forwarding prevent this specific validation and routing mismatch.
What should be done if upgrading is not immediately possible?
Avoid the affected route arrangement: do not use overlapping public exact and protected parameterized routes for the same method when ValidationHandler is followed by a gorilla/mux router using UseEncodedPath. Ensuring an upstream proxy canonicalizes URIs also prevents this specific mismatch.
What version contains the fix?
The issue is fixed in kin-openapi version 0.147.0.