8.1high
Coder's privilege escalation vulnerability could lead to a cross workspace compromise
- Severity
- 8.1high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.44% (higher than 39% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-j6xf-jwrj-v5qpGO-2025-3938
Description
Coder allows organizations to provision remote development environments via Terraform. In versions 2.22.0 through 2.24.3, 2.25.0 and 2.25.1, Coder can be compromised through insecure session handling in prebuilt workspaces. Coder automatically generates a session token for a user when a workspace is started. It is automatically exposed via coder_workspace_owner.session_token. Prebuilt workspaces are initially owned by a built-in prebuilds system user. When a prebuilt workspace is claimed, a new session token is generated for the user that claimed the workspace, but the previous session token for the prebuilds user was not expired. Any Coder workspace templates that persist this automatically generated session token are potentially impacted. This is fixed in versions 2.24.4 and 2.25.2.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| coder coder | >= 2.22.0, < 2.24.4, >= 2.25.0, < 2.25.2, from 2.22 before 2.24.4, from 2.25.0 before 2.25.2 | CVE List, NVD |
| github.com/coder/coder/v2 (Go) | from 2.22.0 before 2.24.4, from 2.25.0 before 2.25.2 | GitHub Advisory Database, Go Vulnerability Database |
| github.com/coder/coder (Go) | all versions | Go Vulnerability Database |
All scores
| GitHub_M | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N |
| GitHub | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N |
| NVD | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N |
Classification
What each source says
CVE List
Coder allows organizations to provision remote development environments via Terraform. In versions 2.22.0 through 2.24.3, 2.25.0 and 2.25.1, Coder can be compromised through insecure session handling in prebuilt workspaces. Coder automatically generates a session token for a user when a workspace is started. It is automatically exposed via coder_workspace_owner.session_token. Prebuilt workspaces are initially owned by a built-in prebuilds system user. When a prebuilt workspace is claimed, a new session token is generated for the user that claimed the workspace, but the previous session token for the prebuilds user was not expired. Any Coder workspace templates that persist this automatically generated session token are potentially impacted. This is fixed in versions 2.24.4 and 2.25.2.
GitHub Advisory Database
Summary
Insecure session handling opened room for a privilege escalation scenario in which prebuilt workspaces could be compromised by abusing a shared system identity.
Details
Coder automatically generates a session token for a user when a workspace is started. It is automatically exposed via coder_workspace_owner.session_token. Prebuilt workspaces are initially owned by a built-in prebuilds system user.
When a prebuilt workspace is claimed, a new session token is generated for the user that claimed the workspace, but the previous session token for the prebuilds user was not expired. Any Coder workspace templates that persist this automatically generated session token are potentially impacted.
For example, the coder-login module allows template authors to automatically configure the coder CLI to be authenticated with the Coder deployment.
This causes a script to be run on workspace startup that runs the command coder login using the automatically generated user session token c.f. https://github.com/coder/registry/blob/8677e7d52b374b025c4820d09049dc6b008beee8/registry/coder/modules/coder-login/main.tf#L23
This module was originally written before the inception of the prebuilds feature in Coder, which essentially creates a "pre-warmed" pool of workspaces owned by a particular prebuilds system user.
When this module is invoked on a prebuilt workspace, it causes the Coder CLI inside the workspace to persist the session token for the prebuilds user to disk. Because the coder-login module checks if the CLI is authenticated, the script exits early before updating the session token, leaving the Coder CLI authenticated as the prebuildsuser upon claim:
Impact
Important: Deployments that have never utilized the prebuilds feature are not affected by this vulnerability.
This vulnerability requires a previously authenticated user to claim a prebuilt workspace from a template configured to store the prebuilds user session token as described above.
The prebuilds user has no specific roles, so its credential has the same level of access as a regular member user, meaning a user with the prebuilds user's credential can move laterally to any other prebuilt workspace, or create new workspaces as the prebuilds user.
This means that a malicious authenticated actor can potentially execute code on other workspaces owned by the prebuilds user and potentially access information of other users once they claim a previously poisoned workspace.
Remediation
Fixed in https://github.com/coder/coder/pull/19667
Note that prebuilt workspaces claimed previous to the fix may have been affected by this vulnerability. It is recommended that users re-create their workspace if it was created from a prebuild.
To identify potentially affected workspaces, run the following SQL query against the Coder database:
SELECT w.id, w.name, w.owner_id, u.email
FROM workspaces w
LEFT JOIN users u ON u.id = w.owner_id
WHERE w.owner_id <> 'c42fdf75-3097-471c-8c33-fb52454d81c0'::uuid
AND NOT w.deleted
AND EXISTS (
SELECT 1
FROM workspace_builds AS wb
WHERE wb.workspace_id = w.id
AND wb.initiator_id = 'c42fdf75-3097-471c-8c33-fb52454d81c0'::uuid
);
Previous manually created tokens for the prebuilds user are left as-is. You may wish to review these via
coder tokens list --all
Premium license customers can also take advantage of the audit logs feature to query actions performed by the prebuilds user.
Following filter can be used to verify if no API keys were created by the prebuilds user
would indicate a potentially malicious action aimed at achieving persistence
username:prebuilds resource_type:api_key
Following filter can be used to list all write operations performed by the prebuilds user (including failed attempts to update various settings)
username:prebuilds action:write
Patched versions
Go Vulnerability Database
Coder vulnerable to privilege escalation could lead to a cross workspace compromise in github.com/coder/coder
NVD (es)
Coder permite a las organizaciones aprovisionar entornos de desarrollo remotos a través de Terraform. En las versiones 2.22.0 a 2.24.3, 2.25.0 y 2.25.1, Coder puede verse comprometido debido a un manejo inseguro de la sesión en espacios de trabajo preconstruidos. Coder genera automáticamente un token de sesión para un usuario cuando se inicia un espacio de trabajo. Se expone automáticamente a través de coder_workspace_owner.session_token. Los espacios de trabajo preconstruidos son inicialmente propiedad de un usuario del sistema de preconstrucciones integrado. Cuando se reclama un espacio de trabajo preconstruido, se genera un nuevo token de sesión para el usuario que reclamó el espacio de trabajo, pero el token de sesión anterior para el usuario de preconstrucciones no caducó. Cualquier plantilla de espacio de trabajo de Coder que persista este token de sesión generado automáticamente puede verse potencialmente afectada. Esto se solucionó en las versiones 2.24.4 y 2.25.2.
References
| https://github.com/coder/coder/security/advisories/GHSA-j6xf-jwrj-v5qp | advisory, exploit, mitigation, vendor-advisory, web | |
| https://github.com/coder/coder/pull/19667 | fix, issue-tracking, web | |
| https://github.com/coder/coder/pull/19668 | fix, issue-tracking, web | |
| https://github.com/coder/coder/pull/19669 | fix, issue-tracking, web | |
| https://github.com/coder/coder/commit/06cbb2890f453cd522bb2158a6549afa3419c276 | fix, patch, web | |
| https://github.com/coder/coder/commit/20d67d7d7191a4fd5d36a61c6fc1e23ab59befc0 | fix, patch, web | |
| https://github.com/coder/coder/commit/ec660907faa0b0eae20fa2ba58ce1733f5f4b35a | fix, patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2025-58437 | advisory | |
| https://github.com/coder/coder | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-58437 changed 2025-09-08 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-j6xf-jwrj-v5qp changed 2025-09-17 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2025-3938 changed 2026-03-03 | CC-BY-4.0 |
| NVD | CVE-2025-58437 changed 2026-10-19 | Public domain |