CVE-2026-137547 in Coder
Summary
by MITRE • 11/26/2026
Coder before 2.29.27, 2.30.0 before 2.34.19, 2.35.0 before 2.37.11, 2.38.0 before 2.38.7, and 2.39.0 before 2.39.1 returns database connection errors containing a temporary AWS IAM database password in API key middleware responses. During database connection failures, unauthenticated attackers can send a well-formed but invalid API key to obtain the password and access the PostgreSQL database for 15 minutes.
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Analysis
by VulDB Data Team • 11/27/2026
The vulnerability identified affects multiple versions of Coder, specifically releases prior to version 2.39.1 across several major release branches including 2.29.x through 2.34.x, 2.35.x through 2.37.x, and 2.38.x. This security flaw resides within the API key middleware layer of the application architecture. The core technical issue is an improper error handling mechanism that results in the leakage of sensitive credentials during database connection failures. When the Coder server attempts to establish a connection with its underlying PostgreSQL database using temporary AWS IAM authentication, any failure in this process triggers an exception handler that inadvertently includes the generated temporary password within the HTTP response body sent back to the client requesting API key validation or usage.
This behavior creates a critical information disclosure vulnerability classified under CWE-209: Generation of Error Message Containing Sensitive Information and CWE-532: Insertion of Sensitive Information into Log File, depending on how the error is propagated. The attack vector requires an unauthenticated actor to send a well-formed but invalid API key to the Coder server's authentication endpoints. Under normal circumstances, such requests would result in standard unauthorized access errors. However, due to this flaw, if the database connection fails at that moment or if the attacker can induce a state where the middleware attempts to validate credentials against the database and encounters an error, the response payload will contain the temporary AWS IAM password required for PostgreSQL authentication. This effectively bypasses the intended authentication controls by providing the adversary with valid administrative-level access credentials rather than just rejecting the invalid API key.
The operational impact of this vulnerability is severe due to the specific nature of AWS IAM database authentication. The leaked passwords are temporary and typically have a short lifespan, often around fifteen minutes as noted in reports. While this limits the window of opportunity for exploitation, it does not mitigate the severity of the breach. An attacker who successfully captures one of these temporary credentials can immediately authenticate against the PostgreSQL instance hosting Coder's data store. This grants direct read and potentially write access to all application data, including user profiles, project configurations, deployment logs, and any sensitive information stored within the database schema. The ability to bypass API key validation entirely means that even users without valid tokens or those attempting unauthorized enumeration can gain full administrative control over the backend datastore for a significant period relative to typical attack windows.
From an adversarial perspective, this vulnerability aligns with ATT&CK technique T1078: Valid Accounts and specifically relates to credential harvesting from application errors. It also touches upon T1539: Steal Web Session Cookie if session tokens are derived or linked in ways that allow persistence beyond the temporary password window, though the primary mechanism here is direct database access via leaked credentials. The flaw represents a failure in secure coding practices regarding exception handling and response sanitization. Developers must ensure that internal server errors do not leak stack traces, connection strings, or authentication secrets to external clients. In this case, the middleware logic failed to distinguish between an invalid API key error and a backend database connectivity error, exposing the latter's sensitive data regardless of the client's intent.
Mitigation strategies focus primarily on immediate patching and architectural hardening. The definitive solution is to upgrade Coder to version 2.39.1 or later across all affected release branches, as these versions contain fixes for this middleware logic flaw. Organizations running older versions must prioritize deployment of security patches during their next maintenance window. In the interim, if upgrading is not immediately feasible, administrators should implement network-level controls such as Web Application Firewalls to inspect and sanitize response bodies from Coder endpoints, filtering out any patterns resembling AWS IAM passwords or database connection strings before they reach external clients. Additionally, monitoring for unusual spikes in 500-series HTTP errors combined with specific payload characteristics can help detect active exploitation attempts. Long-term remediation should involve implementing strict error handling policies that return generic messages to users while logging detailed diagnostic information securely on the server side only accessible by authorized administrators through secure channels.