llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/OliveTin/OliveTin

GHSA-GP3Q-Q8QG-J4XF

Revoked or Rotated JWT Signing Keys Remain Trusted Indefinitely (JWKS Never Refreshes)

Sin parche publicado
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición7 dDesde la divulgación, 12 nov 2026, 7:02 p. m.
Detección6 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
13 nov 26
19 nov 26
20 nov 26
13 nov 26
14 nov 26
16 nov 26
18 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-GP3Q-Q8QG-J4XF divulgada
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

Once OliveTin has fetched an IdP's JWKS once, it never refreshes it again for the life of the process. If the IdP later revokes or rotates a signing key, tokens signed with the old key keep authenticating, with attacker-chosen claims, until OliveTin is restarted.

Affected: `main` (3k), all released versions through 3000.18.1, and `release/2k`, all released versions through 2025.11.25. Two independent implementations of the same mistake, not shared code. Requires remote-key JWT auth (`authJwtCertsUrl` pointing at an IdP's JWKS endpoint) to be enabled; not the default, but a documented, supported auth mode on both branches.

Details

On `main`, `initJwks` https://github.com/OliveTin/OliveTin/blob/1a31c4dee47cc76a2df8c3347307a6ef478a76aa/service/internal/auth/otjwt/jwt.go#L83-L101 (`internal/auth/otjwt/jwt.go:83-101`) fetches the JWKS exactly once per process, guarded by a `sync.Once`, and hands `keyfunc.NewDefaultCtx` a context that is cancelled the instant the `Once.Do` closure returns:

func initJwks(cfg *config.Config) error {
	jwksOnce.Do(func() {
		if cfg.AuthJwtCertsURL != "" {
			ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
			defer cancel()

			var err error
			jwksVerifier, err = keyfunc.NewDefaultCtx(ctx, []string{
				cfg.AuthJwtCertsURL,
			})
			...
		}
	})
	return jwksInitErr
}

`keyfunc.NewDefaultCtx` ties its background JWKS-refresh goroutine to the given context for the lifetime of that goroutine, not just the initial fetch. Because `cancel()` fires via `defer` as soon as the closure returns, milliseconds after the first fetch, the refresh goroutine's context is already done before any refresh interval can elapse. Whatever keyset was fetched on the first JWT-bearing request is trusted for the rest of the process's life, with no subsequent refresh ever occurring. Two consequences:

  • An IdP that revokes or rotates a compromised signing key doesn't stop OliveTin trusting tokens signed with the old key. Only a restart does.
  • If the very first JWKS fetch fails transiently, the empty result is retained permanently, and all remote-key JWT auth is broken until restart.

`release/2k`'s `initJwks()` https://github.com/OliveTin/OliveTin/blob/a4fe32b6c1c0ff1fe5113e53d5c9a16e74107c9e/service/internal/httpservers/restapi_auth_jwt.go#L26-L44 (`internal/httpservers/restapi_auth_jwt.go:26-44`) is a separate, independently-written implementation that makes the identical mistake: `ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)` passed to `keyfunc.NewDefaultCtx`, with `defer cancel()` firing as soon as `initJwks()` returns.

Related advisory checked

Not the same root cause as GHSA-g962-2j28-3cg9 https://github.com/OliveTin/OliveTin/security/advisories/GHSA-g962-2j28-3cg9 / CVE-2026-30223 (JWT audience validation bypass in local-key and HMAC modes): that's a claims-validation defect, not a remote-JWKS-mode issue, and it isn't about refresh freshness.

Checked against the currently published advisories and against `.github/SECURITY_ADVISORY_DUPLICATES.md` https://github.com/OliveTin/OliveTin/blob/main/.github/SECURITY_ADVISORY_DUPLICATES.md's tracked clusters: no overlap. The only JWT/OAuth-adjacent clusters concern OAuth2 state-map exhaustion and header-spoof auth bypass, both unrelated to JWKS refresh timing.

PoC

A fully self-contained Go test, run in-process with no external network (the "IdP" is a local `httptest.Server`):

  1. Generate two RSA keypairs (A, B). Serve a JWKS containing only key A.
  2. Mint a JWT signed by key A, `kid: "a"`, claiming `name: attacker-as-admin`, `group: admin`. It verifies and returns the claimed user.
  3. Rotate: the JWKS endpoint now serves only key B. Key A is gone, confirmed by re-fetching the JWKS document directly in the test.
  4. Replay the same token, still signed by the now-revoked key A.

Result:

step 1 OK: key A is published by the IdP, token verifies as
  &{Username:attacker-as-admin UsergroupLine:admin Provider:jwt ...}
IdP now serves: map[keys:[map[... kid:b ...]]] (key A is gone)
step 2 VULNERABLE: token signed by key A, which the IdP no longer publishes,
  STILL verified as &{Username:attacker-as-admin UsergroupLine:admin Provider:jwt ...}
--- PASS: TestPoCStaleJWKSTrust (0.12s)

The revoked key keeps authenticating with arbitrary attacker-chosen claims (`AuthJwtClaimUsername`/`AuthJwtClaimUserGroup` are read straight from the token) for as long as the process runs.

release/2k

Same test methodology, calling the unexported `parseJwt(token string) (username, group string)` directly:

step 1 OK: key A is published by the IdP, token verifies as username="attacker-as-admin" group="admin"
IdP now serves: map[keys:[map[... kid:b ...]]] (key A is gone)
step 2 VULNERABLE: token signed by key A, which the IdP no longer publishes,
  STILL verified as username="attacker-as-admin" group="admin"
--- PASS: TestPoCStaleJWKSTrust2k (0.09s)

(2k's remote-key path also unconditionally applies `jwt.WithAudience(cfg.AuthJwtAud)`, unlike `main`, which skips this when `AuthJwtAud` is empty, so the PoC token needs a matching `aud` claim. That's incidental to reproducing the bug, not part of it.)

Impact
  • A revoked or rotated JWT signing key stays trusted indefinitely, for as long as the process runs, on any deployment using remote-key JWT auth.
  • Exploitation requires only possession of a previously-valid private key (for example from a departed employee, a compromised secret, or a scheduled rotation), and no interaction with OliveTin's auth beyond a normal JWT-bearing request.
Suggested fix

Don't tie the long-lived background refresh to a context that gets cancelled once the `Once.Do` closure returns. Use a context that lives for the process's lifetime instead:

 func initJwks(cfg *config.Config) error {
 	jwksOnce.Do(func() {
 		if cfg.AuthJwtCertsURL != "" {
-			ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
-			defer cancel()
-
+			// keyfunc.NewDefaultCtx ties the JWKS background refresh
+			// goroutine to this context for as long as the process runs, not
+			// just for the initial fetch. A context that gets cancelled here
+			// (e.g. a short-lived timeout context) permanently stops
+			// refreshing, so a key revoked/rotated at the IdP afterwards
+			// stays trusted until restart.
 			var err error
-			jwksVerifier, err = keyfunc.NewDefaultCtx(ctx, []string{
+			jwksVerifier, err = keyfunc.NewDefaultCtx(context.Background(), []string{
 				cfg.AuthJwtCertsURL,
 			})
 			...

I also verified the fixed behaviour directly, not just the mechanism, using `keyfunc.NewDefaultOverrideCtx` https://github.com/MicahParks/keyfunc/blob/v3.8.0/keyfunc.go#L105-L176 with a 50ms refresh interval. It's the identical construction to `keyfunc.NewDefaultCtx` https://github.com/MicahParks/keyfunc/blob/v3.8.0/keyfunc.go#L90-L103 (itself built on `jwkset.NewDefaultHTTPClientCtx` https://github.com/MicahParks/jwkset/blob/v0.11.0/http.go#L85-L112, which hardcodes the 1-hour interval), just with that interval made configurable, so this tests the real mechanism, not a stand-in:

  • Cancelled context (the bug): a token signed by a revoked key still verifies after ten refresh intervals. Zero refreshes occur.
  • Uncancelled context (the fix): the revoked key's token stops verifying, and the new key's token verifies, once the refresh runs.

So rotation is confirmed to actually take effect within the refresh interval after the fix, not just "the cancellation is gone" in theory.

release/2k fix

Same fix: remove the timeout context and its `defer cancel()`. Verified the same way (identical keyfunc/jwkset versions on this branch): zero refreshes with a cancelled context, rotation honoured within the interval with a live one.

 func initJwks() {
 	if jwksVerifier == nil {
 		var err error
 		if cfg.AuthJwtCertsURL != "" {
-			ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)
-
-			jwksVerifier, err = keyfunc.NewDefaultCtx(ctx, []string{
+			jwksVerifier, err = keyfunc.NewDefaultCtx(context.Background(), []string{
 				cfg.AuthJwtCertsURL,
 			})
 			if err != nil {
 				log.Errorf("Init JWKS Failure: %v", err)
 			}
-
-			defer cancel()
 		}
 	}
 }
Notes

Found via automated static analysis, manually reproduced and verified with the working PoC above. Happy to help with anything else, including code review of a fix.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida
github.com/OliveTin/OliveTin≤ 3000.18.1
3000.18.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Gogithub.com/OliveTin/OliveTin
Sin parche — — —
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/OliveTin/OliveTin/security/advisories/GHSA-gp3q-q8qg-j4xf

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.