Repository navigation
Update module github.com/getkin/kin-openapi to v0.149.0 [SECURITY] - #211
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
Contributor
Author
ℹ️ Artifact update noticeFile name: go.modIn order to perform the update(s) described in the table above, Renovate ran the
Details:
|
renovate
Bot
force-pushed
the
renovate/go-github.com-getkin-kin-openapi-vulnerability
branch
from
October 20, 2026 10:33
1fcdbf2 to
0ad6968
Compare
renovate
Bot
force-pushed
the
renovate/go-github.com-getkin-kin-openapi-vulnerability
branch
from
October 22, 2026 10:33
0ad6968 to
16bdcaa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR body was truncated due to platform limits.
This PR contains the following updates:
v0.142.0→v0.149.0kin-openapi: ValidationHandler.Load() Fail-Open Authentication Bypass via NoopAuthenticationFunc Default
GHSA-r277-6w6q-xmqw
More information
Details
Summary
ValidationHandler.Load()ingetkin/kin-openapisilently replaces a nilAuthenticationFuncwithNoopAuthenticationFunc, which always returnsnilwithout performing any credential check. Because this substitution happens unconditionally when the caller omits the field, every OpenAPIsecurityrequirement declared in the spec is silently satisfied for unauthenticated requests. An unauthenticated remote attacker can reach handlers for routes whose OpenAPI operation requires an API key, OAuth token, or any other security scheme if the application relies onValidationHandleras its enforcement middleware.Details
ValidationHandleris an HTTP middleware exported byopenapi3filterthat validates incoming requests and responses against a loaded OpenAPI specification. ItsLoad()method initialises default fields before the handler begins serving:NoopAuthenticationFuncis defined as:It always returns
nil, meaning every security scheme check it handles is automatically approved.When a request arrives,
ServeHTTP→before→validateRequestassembles aRequestValidationInputwith the currentAuthenticationFunc(now the no-op) injected intoOptions:Inside
ValidateRequest, each security requirement callsoptions.AuthenticationFunc:Because
fis the no-op (notnil), theErrAuthenticationServiceMissingguard is never triggered andf(...)returnsnil, clearing the security requirement. Control then proceeds to the protected handler (validation_handler.go:61-62).The critical contradiction is that callers who use
ValidateRequestdirectly with a nilAuthenticationFuncget fail-closed behavior (ErrAuthenticationServiceMissing), while callers who use the higher-levelValidationHandlerwith a nilAuthenticationFuncget fail-open behavior. Since omittingAuthenticationFuncis the natural default, the majority of real-world integrations are vulnerable.Affected source file and line:
openapi3filter/validation_handler.go:47–49(commit30e2923, tagv0.143.0).PoC
Environment
Step 1 — Build the Docker image
From the repository root (parent of
vuln-001/):The
Dockerfilecopies the localkin-openapisource into/kin-openapi/inside the image and builds a Go binary (/poc-binary) frommain.go. Thego.modinside the image uses areplacedirective pointing to/kin-openapi, so no network access to the Go module proxy is required.Step 2 — Run the container
Step 3 (alternative) — Use the Python helper
What the PoC does
main.gocreates a temporary OpenAPI 3.0 spec that declaresGET /secretas protected by anapiKeysecurity scheme:It then constructs a
ValidationHandlerwithout settingAuthenticationFunc, callsLoad(), and sends a request with noX-Api-Keyheader:Expected (vulnerable) output
The contrast block confirms fail-closed behavior when
ValidateRequestis called directly. The exploit block confirms fail-open behavior throughValidationHandler. Status 200 andSECRET_DATAare returned without any credential.Remediation patch
After this change, a nil
AuthenticationFuncpropagates intoValidateRequest, which returnsErrAuthenticationServiceMissingand rejects the request. Callers who genuinely want to skip authentication can still opt in explicitly:h.AuthenticationFunc = openapi3filter.NoopAuthenticationFunc.Impact
This is an authentication bypass vulnerability (CWE-287). Any application that:
openapi3filter.ValidationHandleras its HTTP middleware, andsecurityrequirements in its OpenAPI specification, andAuthenticationFunc,is fully exposed. An unauthenticated remote attacker can send requests to any protected endpoint without supplying credentials; the middleware accepts the request and forwards it to the underlying handler as if authentication had succeeded.
Affected parties include all Go services that adopt
ValidationHandleras a drop-in validation layer and rely on OpenAPIsecuritydeclarations for access control without adding a separate authentication layer upstream (e.g., an API gateway or reverse proxy). Because the insecure behavior is the default, developers following the "getting started" path are affected without any additional mistake.The confidentiality and integrity of data behind secured endpoints are both at high risk. Availability is not directly affected by this vulnerability.
Reproduction artifacts
Dockerfilepoc.pySeverity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
kin-openapi openapi3filter: unauthenticated nil-pointer panic when validating a request against a
contentparameter whose media type has no schemaCVE-2026-73502 / GHSA-jpcw-4wr7-c3vq
More information
Details
github.com/getkin/kin-openapi<= 0.143.0(introduced inv0.2.0, PR #90, 2019-05-07; reproduced onHEAD30e2923)Summary
openapi3filter.ValidateRequestcontains a NULL-pointer-dereference denial of service: any unauthenticated client can crash the request-validation path with a single HTTP request. When an operation declares acontentparameter (as opposed to aschemaparameter) whose media type object has noschema, request validation dereferences that missing schema and panics. The document is legal under the OpenAPI Specification — kin-openapi's owndoc.Validate()accepts it — and the defect affects both OpenAPI 3.0.x and 3.1.x. Depending on how the library is wired into the server (see Impact), this ranges from a per-request abort with unbounded panic-log growth to a full remote process crash.Details
The decoder used for
contentparameters when no customParamDecoderis configured (the library default),defaultContentParameterDecoder, dereferences the media-type schema without a nil check.openapi3filter/req_resp_decoder.go, around line 197:The function guards
param.Content == nil,len(content) != 1, andmt == nil, but nevermt.Schema == nil.Why a schema-less content parameter is legal (so the sink is reachable —
doc.Validate()returns no error), in both 3.0.x and 3.1.x:openapi3/parameter.go—Parameter.Validateonly enforces exactly one ofschemaXORcontent; a parameter withcontent(and noschema) satisfies it.openapi3/media_type.go—MediaType.Validatevalidates the schema only when it is non-nil, so an absent schema is not a validation error.Call path to the panic:
Authentication note:
ValidateRequestvalidates security before parameters, but the panic is reachable without credentials whenever the target operation declares no security requirement, or when noAuthenticationFuncis configured (it is opt-in). A single unauthenticated operation anywhere in the served spec is sufficient. If an operation does declare security and a rejectingAuthenticationFuncis wired, that request is rejected before decoding.PoC
Reproduced end-to-end against
HEAD(30e2923) with a realnet/httpserver and a stockhttp.Client.1. Minimal OpenAPI 3.0.3 document (legal —
doc.Validate()passes). Thecfgquery parameter usescontentwith anapplication/jsonmedia type that has noschema:2. A complete, self-contained program. Drop this into a directory inside a checkout of
github.com/getkin/kin-openapiand run it withgo run .. It loads the document above, assertsdoc.Validate()accepts it (proving reachability), serves it behind request validation exactly as the recommended middleware does, and sends one unauthenticatedGET /c?cfg=1:3. Observed result — the request goroutine panics inside validation, and the client's
http.Getreturns an EOF:Swapping the media type for one that carries a schema (
application/json: {schema: {type: object}}) makes the same request return a clean400instead of panicking, confirming the missing schema is the cause.Impact
This is an unauthenticated remote denial of service (CWE-476) against any service that validates incoming requests with
openapi3filterand serves a spec containing at least onecontentparameter whose media type lacks aschema.The precise consequence depends on which goroutine runs the panic and whether a
recover()covers it:net/http?net/http(incl.openapi3filter.ValidationHandler)http: panic servinglog growth.ValidateRequeston an app-spawned goroutine (fan-out,errgroup, async pre-check)recover().net/httphost (fasthttp adaptor, gRPC-gateway shim, CLI, offline/batch spec validator)This is why the suggested CVSS uses
A:L(Base 5.3): under the recommended synchronousnet/httpwiring the panic is recovered per-connection. Reviewers may reasonably raise it toA:H(Base 7.5) for the spawned-goroutine and non-net/httpintegrations, where a single request kills the process.Remediation (suggested)
Add a
mt.Schema == nilguard mirroring the existingmt == nilguard, so a schema-less content parameter yields a clean validation error instead of a panic:The
unmarshalclosure immediately below already tolerates a nil schema (it checksparamSchema != nil), so returning early on nilmt.Schemais consistent with surrounding intent.Workarounds for consumers, pending a patch:
contentparameter in served specs declares aschema, or reject such specs at load time.ParamDecoderthat guardsmt.Schema == nil.recover()— especially if validation runs off the request goroutine or on a non-net/httphost.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
kin-openapi: Nil-pointer dereference panic in openapi3filter for OpenAPI 3.1 array schemas missing items
CVE-2026-97394 / GHSA-p6wj-qrr4-pgh5
More information
Details
Summary
A nil-pointer dereference in
openapi3filterlets any unauthenticated client crash a request handler with a single HTTP request against an OpenAPI 3.1 operation that declarestype: arraywithoutitems. OpenAPI 3.1 (JSON Schema 2020-12) permits omittingitems, anddoc.Validate()accepts such schemas withSchema.Items == nil. Request/response decoders then dereferenceItemswith no nil check. The panic is deterministic (100%) on every request to the affected operation. There is norecover()inopenapi3filter; under handlers without per-request recover the process can exit.Details
Spec-validation asymmetry. OpenAPI 3.0 rejects array schemas that omit
items(openapi3/schema.goaround theTypeArray/newSchemaItemsRequiredbranch). For OpenAPI 3.1,T.ValidateenablesjsonSchema2020ValidationEnabled, so that check is skipped andSchema.Itemsremains nil after a cleandoc.Validate().Vulnerable decoder. The primary request-side crash is in
UrlencodedBodyDecoder(still present on this checkout at L1421):This runs during schema inspection before form values are parsed. Any non-empty
application/x-www-form-urlencodedbody for the operation reaches the dereference (an empty body is rejected earlier whenrequestBody.requiredis true, and never enters the decoder).The same nil
Itemsalso crashes:MultipartBodyDecoderreq_resp_decoder.go~1564 → 1579multipart/form-datapart named like the array propertyparseArray→parsePrimitivereq_resp_decoder.go~1129 / 1151ValidateResponse, and path/cookie array paramsMiddleware/ValidationHandlercallValidateRequest/ValidateResponsedirectly with no recover, so the panic escapes the library into the application.Recommended fix. Guard nil
Itemsand return a structured decode/validation error, e.g.:case propType.Is("array"): + if propSchema.Value.Items == nil || propSchema.Value.Items.Value == nil { + return nil, fmt.Errorf("unsupported schema of request body's property %q: array items required for decoding", propName) + } items := propSchema.Value.Items.ValueApply equivalent guards in
MultipartBodyDecoderandparseArraybefore callingparsePrimitive.PoC
Verified against revision
c11a4812ba7be3ee3d81453be0c397ee84c238d5, Go 1.25,darwin/arm64.1. Spec — OpenAPI 3.1 operation with urlencoded body and
type: arrayproperty withoutitems:2. E2E program —
net/httpserver using the same public entrypoint (gorillamux→openapi3filter.ValidateRequest) real middleware uses. Save asmain.goin a module that depends ongithub.com/getkin/kin-openapiat a vulnerable revision, thengo run .:3. Observed output (
go run .):Then:
Server log:
Stack pins the fault to
UrlencodedBodyDecoderatreq_resp_decoder.go:1421, called fromValidateRequest→ValidateRequestBody→decodeBody.Attack request:
(Any non-empty body is enough; form content is irrelevant because
Itemsis dereferenced during schema inspection before parsing.)4. Regression / multi-surface test suite — save as e.g.
openapi3filter/array_items_nil_panic_test.goin a checkout of the module and rungo test -run TestArrayItemsNilPanic ./openapi3filter/ -v:Observed results on the vulnerable tree:
Items == nil); 3.0 rejects itnil pointer dereferenceValidateRequest→ HTTP 500Impact
github.com/getkin/kin-openapi/openapi3filterto validate requests/responses against OpenAPI 3.1 documents that contain anitems-lesstype: arrayin a urlencoded or multipart body property, or an array-typed response header (or otherparseArraysurfaces). Specs may be author mistakes, codegen output, or attacker-supplied where untrusted documents are loaded —doc.Validate()does not reject them under 3.1.net/http, the server logshttp: panic servingand aborts the connection; without per-request recover (common outside purenet/httphandlers), the process can crash.items); JSON request bodies (different decoder path that does not hit thisItems.Valueinspection).Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
kin-openapi: Incomplete Fix for GHSA-p6wj-qrr4-pgh5: Three Unpatched nil-Items Panic Paths in openapi3filter
CVE-2026-100353 / GHSA-vrcc-3ch7-hppw
More information
Details
Summary
The fix for GHSA-p6wj-qrr4-pgh5 addressed a nil-pointer dereference that occurs when an OpenAPI 3.1 array schema omits the
itemskeyword (which is legal under JSON Schema 2020-12). That fix patched three decoder paths: the standaloneparseArrayfunction, the top-level array check inUrlencodedBodyDecoder, andMultipartBodyDecoder.Three additional crash paths were missed. All of them reach the unguarded
urlValuesDecoder.parseArraymethod (openapi3filter/req_resp_decoder.go:576) or the unguarded array branch inbuildResObj(line 1015):type: arrayand noitems.items.allOf/anyOf/oneOfsub-schema. This path bypasses the guard added by the GHSA-p6wj-qrr4-pgh5 fix, because that guard only inspects top-level properties.Each path is triggerable by an unauthenticated client and produces a deterministic nil-pointer panic during request validation.
Details
Root Cause
The three paths patched for GHSA-p6wj-qrr4-pgh5 each received a nil-
itemsguard:But
urlValuesDecoder.parseArray(line 576), which handles query-parameter and urlencoded-body array decoding, has no such guard:parseValueimmediately dereferences the schema it is handed:For the deepObject path,
buildResObj(line 1015) has the same gap. Its array branch recurses withschema.Value.Items(line 1028), which can be nil, and the recursive call dereferences it at line 1015:For the allOf body path,
UrlencodedBodyDecodervalidates only top-levelschema.Value.Properties(line 1429-1449). ButdecodeSchemaConstructs(line 1474) recursively walksAllOf/AnyOf/OneOfsub-schemas and callsdecodePropertyon their properties, which never pass through the top-level guard and reachurlValuesDecoder.parseArray.Proof of Concept
Environment
v0.144.0, commitf0407d5)doc.Validate()first to prove the spec is legal, then drivesopenapi3filter.ValidateRequestdirectlyPath 1: Query parameter array without items
Spec (query param
idsistype: array, noitems), requestGET /test?ids=1&ids=2:Path 2: deepObject nested array without items
Spec (deepObject param
filterwith array propertytags, noitems), requestGET /test?filter[tags][0]=a:Path 3: URL-encoded body with array inside allOf (bypasses the existing fix)
Spec (urlencoded body,
allOfsub-schema with array propertytags, noitems), requestPOST /submitbodytags=a&tags=b:The
decodePropertyframe confirms the array was reached by walking theallOfsub-schema, bypassing the top-level guard that the GHSA-p6wj-qrr4-pgh5 fix added.Fix verification
Adding a single nil-
itemsguard tourlValuesDecoder.parseArray(plus one to thebuildResObjarray branch) turns all three panics into clean validation errors:This confirms
urlValuesDecoder.parseArrayis the shared root cause for Paths 1 and 3, andbuildResObjfor Path 2.Impact
An unauthenticated client can trigger a deterministic nil-pointer panic in request validation with a single crafted request, against any application that validates OAS 3.1 requests with
openapi3filterwhere a spec declares an array withoutitems.The severity depends on the host:
net/httpserver (validation runs in the handler goroutine)net/httprecovers the panic per-connection; the connection is dropped and the process survivesnet/httphosts (e.g. fasthttp/connect adapters) or validation performed in an application-spawned goroutineThis was verified in both configurations: under a live
net/httpserver the process survived (the panic was logged ashttp: panic serving ...and the process exited 0 at end of test), while the direct-call PoCs above crashed the process withexit status 2.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
kin-openapi spec loader panics on a self-referential additionalProperties $ref (nil-pointer DoS)
CVE-2026-100348 / GHSA-mh7x-f8wq-4jhx
More information
Details
The defect
Confirmed at HEAD (f0407d5, v0.144.0). openapi3/loader.go, inside resolveComponent's drill closure (around line 455), the case *SchemaRef branch for pathPart == "additionalProperties" dereferences c.Value.AdditionalProperties with no nil-check on c.Value:
When a $ref fragment drills through .../additionalProperties of a schema whose Value is still nil (a pure, not-yet-resolved $ref, or a self-reference resolved before its own Value is set), c.Value is nil and the .AdditionalProperties access panics.
Input and attacker
A tiny crafted OpenAPI document, one schema, no external refs, no network:
Attacker model: any service or tool that loads an untrusted spec via the default openapi3.Loader (LoadFromData / LoadFromFile / LoadFromURI), e.g. a spec registry, an API-management platform ingesting user specs, a linter, or a converter. It crashes during LOAD (ResolveRefsIn), before Validate.
Verification level
EXECUTED with negative controls (agent-run go test at HEAD f0407d5, including yesterday's security merge; the bug is still present). The full stack pins LoadFromData:196 -> ResolveRefsIn:274 -> resolveSchemaRef:1048 -> resolveComponent:485 -> drill:439 -> :455, propagating to main(); no recover() in loader.go/schema.go (grep + trace). Two negative controls stay clean: drilling additionalProperties of a resolved schema loads fine (the existing TestIssue376 happy path), and a normal recursive schema loads fine, so the nil Value is specifically the cause. I independently re-confirmed at HEAD that loader.go:455 dereferences c.Value.AdditionalProperties with no nil-check on c.Value. NOT verified: I did not enumerate every consumer's recover posture.
Suggested fix
Add if c.Value == nil { break } (fall through to the nil-safe drillIntoField) before touching c.Value.AdditionalProperties. One line.
Also cleared (stated, not claimed)
The allOf/anyOf $ref diamond does not blow up: Schema.validate threads its stack through the return and never pops it, acting as a global pointer-keyed visited-set (executed N=10..30, microseconds). External-ref SSRF/path-traversal is blocked by default (IsExternalRefsAllowed=false); the known custom-ReadFromURIFunc bypass is the already-banked downstream oasdiff item.
Advisory-source note
Five-source enumeration: every kin-openapi advisory (CVE-2025-30153 plus the five fresh July-2026 GHSAs) is in openapi3filter (request validation); this finding is in the openapi3 loader, untouched by that systematic reporter and flagged un-analyzed by the prior oasdiff scout. Not contested on the loader surface as of today (a systematic hunter could pivot, so it decays; submit reasonably promptly).
Dedup
Dedup gate clean: no kin-openapi loader verdict in COVERED-INDEX, DISCLOSURE-INDEX or SCOUT-EXCLUDE (the one DISCLOSURE-INDEX hit is report #313, the downstream oasdiff, a different repo/lane).
Tooling
AI assistance was used while investigating. The panic is executed-verified with negative controls (a one-schema self-referential additionalProperties $ref crashes LoadFromData while a resolved additionalProperties and a normal recursive schema load fine), and I confirmed at HEAD that loader.go:455 dereferences c.Value.AdditionalProperties with no nil-check on c.Value, on a load path with no recover.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
kin-openapi: Unauthenticated panic (DoS) in openapi3filter legacy router via non-canonical/unsupported HTTP method on a static path
CVE-2026-100347 / GHSA-fh4f-47mf-f2gj
More information
Details
Summary
The
openapi3filter.ValidationHandler(the exported, documented request-validation middleware) hard-wires the