REDHAT-BUG-2521202: Medium severity go/github.com/getkin/kin-openapi vulnerability
kin-openapi is a Go project for handling OpenAPI files. From 0.10.0 until 0.141.0, openapi3filter.convertParseError in openapi3filter/validationerrorencoder.go dereferences e.Parameter.In without checking whether e.Parameter is nil. A malformed non-string scalar field in a multipart/form-data request body produces a nested ParseError with a nil RequestError.Parameter, and applications that render the validation error through openapi3filter.ConvertErrors or ValidationErrorEncoder panic. An unauthenticated client can repeatedly send such requests to deny service when the application lacks a recovery boundary. JSON request bodies and applications that do not use these error-rendering helpers are not affected. This issue is fixed in version 0.141.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
kin-openapito a version that resolves this vulnerability.Fixed in 0.141.0
Event History
Frequently Asked Questions
Which applications are exposed to denial of service?
Applications using affected kin-openapi versions are exposed when they accept multipart/form-data requests, encounter malformed non-string scalar fields, and render validation failures through openapi3filter.ConvertErrors or ValidationErrorEncoder. JSON request bodies and applications that do not use these error-rendering helpers are not affected.
Does an attacker need authentication or special access?
No. An unauthenticated client can repeatedly submit the malformed multipart/form-data requests to trigger a panic and deny service, provided the application has no recovery boundary.
What versions are affected and what version fixes the issue?
The issue affects versions from 0.10.0 until 0.141.0. It is fixed in version 0.141.0.
What can reduce impact if upgrading is not immediately possible?
Avoid using openapi3filter.ConvertErrors or ValidationErrorEncoder for affected multipart/form-data validation errors, or ensure the application has a recovery boundary so a panic does not terminate service.