REDHAT-BUG-2518119: Medium severity go/github.com/getkin/kin-openapi vulnerability
kin-openapi is a Go project for handling OpenAPI files. From 0.2.0 until 0.144.0, openapi3filter.ValidateRequest can encounter a NULL-pointer-dereference denial of service when an operation declares a content parameter whose application/json media type has no schema. In openapi3filter/reqrespdecoder.go, the default defaultContentParameterDecoder dereferences mt.Schema.Value without checking whether mt.Schema is nil, even though doc.Validate() accepts the document under OpenAPI 3.0.x and 3.1.x. A single unauthenticated request supplying the parameter value can panic request validation, causing an aborted request with log growth in the common synchronous net/http path or a full process crash in integrations without recovery. This issue is fixed in version 0.144.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.144.0
Event History
Frequently Asked Questions
Which deployments are exposed to this denial of service?
Deployments using kin-openapi versions from 0.2.0 before 0.144.0 are exposed when they validate requests for an OpenAPI operation that declares a content parameter with application/json but no schema. Documents accepted by doc.Validate() under OpenAPI 3.0.x or 3.1.x can contain the affected configuration.
What does an attacker need to trigger the issue?
An attacker only needs to send a single unauthenticated request that supplies the affected parameter value. The request reaches openapi3filter.ValidateRequest and can trigger a nil-pointer dereference.
What is the operational impact if the issue is triggered?
In the common synchronous net/http path, request validation aborts and can produce log growth. Integrations that do not recover from the panic can experience a full process crash.
What can be done if upgrading is not immediately possible?
Avoid OpenAPI operations with content parameters whose application/json media type has no schema, or ensure request-validation panics are recovered by the integration. Upgrade to version 0.144.0 when possible.