Kin openapi: kin-openapi openapi3filter: unauthenticated nil-pointer panic when validating a request against a `content` parameter whose media type has no schema
Affects github.com/getkin/kin-openapiSource GCVE Database
- Patch
- Available – fixed in 0.144.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LWhat to do
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| Gogithub.com/getkin/kin-openapi | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
Upgrade kin-openapi to version 0.144.0 or later, where this vulnerability is fixed. If upgrading is not immediately possible, ensure that all operations declare security requirements and configure an AuthenticationFunc that rejects unauthenticated requests, preventing unauthenticated access to vulnerable request validation paths.
Description
A null-pointer dereference vulnerability exists in kin-openapi's openapi3filter.ValidateRequest function, allowing unauthenticated clients to cause a denial of service by sending a single HTTP request. The issue occurs when validating a request against a content parameter whose media type object lacks a schema, which is legal under the OpenAPI specification. This leads to a panic and potential process crash in versions up to 0.143.0. The vulnerability affects both OpenAPI 3.0.x and 3.1.x and is patched in version 0.144.0.
Impact
An unauthenticated attacker can cause a denial of service by triggering a nil-pointer panic in the request validation path, potentially crashing the server process or causing unbounded panic log growth. This can disrupt service availability. There is no impact on confidentiality or integrity. The vulnerability affects both OpenAPI 3.0.x and 3.1.x specifications as implemented by kin-openapi versions up to 0.143.0.
Summary
The kin-openapi library's openapi3filter.ValidateRequest function dereferences a nil pointer when validating requests containing a content parameter with a media type object that has no schema. Although the OpenAPI specification permits content parameters without schemas, the library's defaultContentParameterDecoder does not check for a nil schema before dereferencing it, causing a panic. This vulnerability can be triggered by unauthenticated clients if the target operation has no security requirements or if no AuthenticationFunc is configured. The issue affects versions <= 0.143.0 and is fixed in version 0.144.0.
Weaknesses
References
- github.com/getkin/kin-openapi/security/advisories/GHSA-jpcw-4wr7-c3vq (opens in a new tab)
- github.com/getkin/kin-openapi/commit/68ac2affa325514d7d6e731204d6a1edf6bdff64 (opens in a new tab)
- github.com/getkin/kin-openapi (opens in a new tab)
- github.com/getkin/kin-openapi/releases/tag/v0.144.0 (opens in a new tab)