---
id: "CVE-2026-89313"
kind: "vulnerability"
aliases: ["CVE-2026-89313"]
title: "JwksTrustStore.Get returns the wrong signing key when kid is missing"
severity: "medium"
cvss: 6.3
epss: 0.00207
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["go", "jwks", "jwt", "package"]
not_affected_if: []
published_at: "2026-10-23T09:17:07+00:00"
first_seen_at: "2026-10-23T21:57:32+00:00"
updated_at: "2026-10-25T04:00:05+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-89313", "first_seen_at": "2026-10-23T21:57:32+00:00"}, {"source": "epss", "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-89313", "first_seen_at": "2026-10-24T07:15:51+00:00"}]
---

# JwksTrustStore.Get returns the wrong signing key when kid is missing

When a requested key ID is absent from a JWKS document, JwksTrustStore.Get returns the last key in the document with a nil error instead of reporting not found. A caller that trusts that key can accept tokens verified against the wrong key.

_Summary, check and fix written by a model from the sources; labelled as such._

## Timeline

- 2026-10-23T21:57:32+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-89313
- 2026-10-24T07:15:51+00:00 epss https://api.first.org/data/v1/epss?cve=CVE-2026-89313

## From the sources

`JwksTrustStore.Get` assigned each parsed key to the function's **named return value** while refreshing the JWKS cache. When the requested `kid` was not present, the trailing naked `return` handed the caller the last key in the JWKS document together with a `nil` error — a confidently wrong answer instead of "not found".

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
