GHSA-FXMJ-CJVJ-X372
OAuth2 session token is the state parameter — exposed in URLs and INFO-level logs, enabling session hijacking / account takeover
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-FXMJ-CJVJ-X372 divulgada · CVSS 8.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
For OAuth2 logins, OliveTin uses the same random value as both the OAuth `state` (CSRF) parameter and the long-lived session identifier (`olivetin-sid-oauth` cookie). That value travels in URL query strings (to the IdP in the authorization request, and back in the `/oauth/callback?...&state=` URL) and is additionally written to OliveTin's own logs at INFO level. It is never rotated after authentication. Anyone who can read that value — from OliveTin's logs, a reverse-proxy/SIEM access log, the IdP's logs, the `Referer` header, or browser history — obtains a working session token for the user who logged in and can authenticate as them by setting it as their own `olivetin-sid-oauth` cookie. Because OliveTin is intentional RCE, hijacking a user with `exec` ACLs yields command execution as that user.
Details
### Affected component
`service/internal/auth/otoauth2/restapi_auth_oauth2.go` (OAuth2 login / callback / session lookup). Verified on tag 3000.21.0.
### Root cause
`HandleOAuthLogin` generates `state`, stores it server-side, puts it verbatim in the `olivetin-sid-oauth` cookie, logs it at INFO, and sends it to the IdP in the URL:
state, err := randString(16)
...
h.setOAuthCallbackCookie(w, r, "olivetin-sid-oauth", state) // cookie value == state
log.Infof("OAuth2 state: %v mapped to provider %v ...", state) // token written to INFO log
http.Redirect(w, r, provider.AuthCodeURL(state), http.StatusFound) // token in URL -> IdP / proxy logs / Referer`HandleOAuthCallback` only fills in the username on the existing entry and redirects — no new session id / cookie is issued:
registeredState, state, ok := h.checkOAuthCallbackCookie(w, r) // /oauth/callback?code=..&state=<token>
...
h.registeredStates[state].Username = userinfo.Username
http.Redirect(w, r, "/", http.StatusFound) // cookie (== pre-auth state) unchanged`CheckUserFromOAuth2Cookie` → `lookupOAuth2UserByState` resolves the cookie value directly to the authenticated user and performs no `createdAt`/expiry check (stale entries are only removed by a sweep that runs when someone hits `/oauth/login`; the 900s cookie `MaxAge` is client-side only).
Proof of concept
- Guest baseline: `POST /api/WhoAmI {}` → `{"authenticatedUser":"guest","acls":[]}`.
- Victim logs in. The login redirect — logged by the IdP, any reverse proxy, and present in Referer/history — contains the token, identical to the cookie:
- OliveTin's own stdout log, at default INFO level, contains the token:
- Attacker (separate client, no victim cookies) uses only that value:
- RCE by design via the hijacked session:
Impact
Account takeover / session hijacking of any OAuth2 user whose login token is observable in a log or URL. For users with `exec` ACLs this is remote command execution as that user. A single operator or log-pipeline consumer can harvest valid tokens for all OAuth2 users.
### Why this is not an existing advisory
- Not GHSA-xpxj-f2fm-rqch (OAuth2 *state-map memory DoS*) — that is unbounded map growth; this is the token *value* being reused and exposed. The listed fix for that cluster ("TTL sweep to match the 15-minute cookie MaxAge") actually reinforces the expiry weakness here.
- Not GHSA-3v7p (OAuth2 auth bypass via `authHttpHeaderUsername` spoofing) — this requires no header spoofing and no trusted-header configuration.
Checked against `.github/SECURITY_ADVISORY_DUPLICATES.md` (live `main`, 2026-11-06): no cluster covers session-token reuse, token exposure via URL/logs, session rotation, or server-side session expiry.
### Remediation
1. On successful callback, generate a fresh session id (`randString`) and set it as `olivetin-sid-oauth`; store the user under the new id and delete the `state` entry. Treat `state` as single-use and discard it after the callback — never reuse it as the session token (this also rotates the session on privilege change, closing fixation).
2. Stop logging the raw `state`/session value (drop it from the INFO log line, or redact it).
3. Enforce server-side expiry in `lookupOAuth2UserByState` (reject entries older than the session lifetime) instead of relying on a login-triggered sweep and the client-side cookie `MaxAge`.
### How it was found
Manual source review tracing the lifetime of `state` from `HandleOAuthLogin` → `AuthCodeURL`/cookie/INFO-log → `HandleOAuthCallback` → `CheckUserFromOAuth2Cookie`, confirmed with a local source build and a mock OAuth2 provider.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Gogithub.com/OliveTin/OliveTin |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/OliveTin/OliveTin/security/advisories/GHSA-fxmj-cjvj-x372Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
