# Xen Orchestra: Empty-object login token

Empty-object JSON cookie `authenticationToken=j:{}` bypasses Xen Orchestra REST auth, returning the first stored token and granting admin access.

- Payout: Research
- Severity: critical
- Program: Xen Orchestra
- Found by: mad31k
- Disclosed: 2026-11-23
- CVE: CVE-2026-133469
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-2r3w-c2vx-fv5g
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-2r3w-c2vx-fv5g
- Tags: area:web domain:api domain:web impact:ato impact:privesc impact:rce kind:research platform:ghsa sev:critical tech:rest technique:source-review vuln:access-control vuln:auth-bypass

**Target:** REST API authentication (xo-server, /rest/v0)
**Root cause:** signIn() lacks a params schema so credentials.token can be any JSON value; the token provider only checks truthiness, and Collection#first({}) treats an empty object as an unfiltered lookup returning the first token.
**Steps:**
1. Note `signIn(credentials)` in `packages/xo-server/src/api/session.mjs` has no `params` schema, so `credentials.token` accepts any JSON type.
2. Observe token provider: `if (!tokenId) return` — `{}` is truthy, so it proceeds to `app.getAuthenticationToken(tokenId)`.
3. `getAuthenticationToken(properties)` accepts an object; `_getAuthenticationToken` calls `this._tokens.first(properties ?? id)`.
4. In `collection/redis.mjs`, `if (isEmpty(properties)) return redis.sMembers(prefix + '_ids')` returns all tokens; `first` yields the first one.
5. `cookie-parser` parses `j:`-prefixed cookies as JSON, so send `authenticationToken=j:{}`.
6. `curl -b 'authenticationToken=j:{}' https://<ip>/rest/v0/users` returns 200 as the first token's owner (admin).
7. Use returned token IDs from `/rest/v0/users/me/authentication_tokens` on a fresh request.
**How found:** Code review of the auth path: noticed `signIn` lacked a params schema unlike `signInWithToken`, traced the token provider's truthiness check, then followed `Collection#first` into the Redis backend where an empty object triggers an unfiltered `sMembers` lookup; combined with cookie-parser's `j:` JSON decoding.
**Exploitation:** Attacker sends a single request with cookie `authenticationToken=j:{}`; the server resolves the first stored token, authenticates as its owner if unexpired, and the authenticated tokens route leaks reusable login token IDs. Admin access to Xen Orchestra enables arbitrary code execution on managed pools and root takeover of XCP-ng nodes.
**Escalation:** Admin REST access → XO control over managed pools → RCE on hosts and full XCP-ng node takeover as root.
**Insight:** When an auth token parameter is typed as `string` in one endpoint but untyped in another, feed JSON objects/arrays instead of strings — ORM/collection `first(properties)` helpers often treat `{}` as 'no filter' and return an arbitrary record, turning a type-confusion into auth bypass.

## Proof of concept (copied exactly from the original report)

**curl request with empty-object auth cookie**

```
curl -b 'authenticationToken=j:{}' https://<ip>/rest/v0/users
```

