CVE-2026-89313 in KeyPont
Summary
by MITRE • 10/23/2026
`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".
Once again VulDB remains the best source for vulnerability data.
Analysis
by VulDB Data Team • 10/23/2026
The vulnerability identified as CVE-2024-36517 represents a critical logic flaw within the JwksTrustStore implementation, specifically affecting how JSON Web Key Sets are cached and retrieved. The core issue stems from an improper handling of named return values in Go during the cache refresh operation. When the Get function is invoked to retrieve a specific key identified by its unique identifier or kid, it attempts to locate this key within the JWKS document stored in memory. If the requested kid is not found among the keys present in the current set, the code executes a trailing naked return statement. Because the function utilizes named return values that were previously assigned during the parsing of each key in the loop, this naked return does not reset these variables to their zero values or indicate an error condition explicitly for missing resources. Instead, it returns the last parsed key along with a nil error object. This behavior creates a scenario where the system confidently asserts success while providing incorrect data, effectively bypassing standard validation checks that rely on explicit error signals for resource unavailability.
From a technical perspective, this flaw is classified under CWE-253, which covers Incorrect Check of Function Return Value, and more specifically relates to improper handling of return values in conditional logic paths where the absence of a target results in unintended state leakage. The vulnerability exploits the Go language feature allowing functions to have named result parameters that are automatically returned if no explicit return statement with arguments is present. In this context, the loop iterates through keys, assigning each parsed key to the named return variable before checking for matches. When the loop completes without finding a match, the final state of that variable remains as the last item processed rather than being cleared or marked as invalid. This leads to CWE-209, which describes an Information Exposure Through an Error Message, although in this case, it is more accurately described as data integrity failure due to silent misdirection rather than explicit leakage. The system fails to distinguish between a successful retrieval and a failed lookup with residual state, violating the principle of least surprise for developers expecting standard error handling patterns.
The operational impact of this vulnerability can be severe depending on how the JwksTrustStore is utilized within an authentication or authorization pipeline. If this component is responsible for validating JSON Web Tokens by verifying their signatures against public keys fetched from a remote provider, returning a wrong key instead of signaling that the kid was not found allows attackers to potentially forge tokens. An attacker who controls one valid token signed with any key in the JWKS set could attempt to manipulate claims or headers while retaining the signature validity if they can influence which key is returned as the default fallback. Furthermore, this behavior undermines trust verification mechanisms because services relying on strict kid matching will accept a token signed by an unrelated key, assuming it was correctly validated against the intended public key. This breaks the cryptographic binding between the identity provider and the service consumer, potentially leading to unauthorized access or privilege escalation if the misidentified key belongs to a different tenant or user group within a multi-tenancy architecture.
Mitigation strategies must focus on correcting the control flow logic within the Get function to ensure that missing keys are explicitly handled as errors rather than defaulting to residual state. Developers should modify the return statement to include an explicit error indicating that the requested kid was not found, ensuring that named return values do not leak unintended data across different invocation contexts. Additionally, implementing strict input validation and logging for cache miss events can aid in monitoring and detecting such anomalies during runtime. It is also advisable to review other instances of similar patterns within the codebase where naked returns are used with mutable state variables inside loops or conditional blocks that may leave residual values. Updating to a patched version of the library, once available, is the primary remediation step for end-users who cannot immediately modify source code. Security teams should audit their integration points to ensure no downstream components rely on implicit success states from this function without verifying the actual key identity matches expectations.