REDHAT-BUG-2553584: Medium severity go/github.com/getkin/kin-openapi vulnerability
kin-openapi is a Go project for handling OpenAPI files. From 0.145.0 until 0.146.0, openapi3filter repeatedly calls regexp.MustCompile for the same parameter-name regular expression inside the per-query-key loop in urlValuesDecoder.DecodeObject used to decode a deepObject query parameter. An unauthenticated remote client can send an affected endpoint a request containing many unrelated query keys, causing ValidateRequest to perform work and allocations proportional to the attacker-controlled key count for every deepObject parameter. The expression itself is fixed and this is not regular expression denial of service; the resource consumption comes from loop-invariant recompilation. This issue is fixed in version 0.146.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.146.0
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Deployments using kin-openapi versions from 0.145.0 up to, but not including, 0.146.0 are affected when they validate requests for endpoints with deepObject query parameters. The affected code is in openapi3filter request validation.
What does an attacker need to do to trigger the resource consumption?
An unauthenticated remote client only needs to send a request to an affected endpoint with many unrelated query-string keys. Each key causes repeated compilation of the same parameter-name regular expression for every deepObject parameter processed during ValidateRequest.
Is this a regular-expression denial-of-service issue?
No. The regular expression is fixed; the resource use results from recompiling it repeatedly inside a loop, causing work and allocations to scale with the attacker-controlled number of query keys.
What version contains the fix?
Version 0.146.0 fixes the issue.