CVE-2025-58437: Coder's privilege escalation vulnerability could lead to a cross workspace compromise

Published Sep 5, 2025
·
Updated

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 coderworkspaceowner.sessiontoken. 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:

sql SELECT w.id, w.name, w.ownerid, u.email FROM workspaces w LEFT JOIN users u ON u.id = w.ownerid WHERE w.ownerid <> 'c42fdf75-3097-471c-8c33-fb52454d81c0'::uuid AND NOT w.deleted AND EXISTS ( SELECT 1 FROM workspacebuilds AS wb WHERE wb.workspaceid = w.id AND wb.initiatorid = '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 resourcetype:apikey

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 - 2.24.4 - 2.25.2 - 2.26.0

Other sources

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 coderworkspaceowner.sessiontoken. 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.

MITRE

Affected Software

4 affected componentsFixes available
go/github.com/coder/coder/v2>=2.25.0<2.25.2
2.25.2
go/github.com/coder/coder/v2>=2.22.0<2.24.4
2.24.4
Coder Coder Go>=2.22<2.24.4
Coder Coder Go>=2.25.0<2.25.2

Event History

Sep 5, 2025
Advisory Published
via GitHub·08:19 PM
Data Sourced
via GitHub·08:19 PM
DescriptionSeverityWeaknessAffected Software
Sep 6, 2025
CVE Published
via MITRE·02:30 AM
Data Sourced
via MITRE·02:30 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:15 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:15 AM
RemedyAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-58437?

CVE-2025-58437 is categorized as a privilege escalation vulnerability that can compromise prebuilt workspaces.

2

How do I fix CVE-2025-58437?

To fix CVE-2025-58437, upgrade to Coder version 2.25.2 or 2.24.4, as these versions contain the necessary security patches.

3

Which versions are affected by CVE-2025-58437?

CVE-2025-58437 affects Coder versions between 2.22.0 and 2.25.2, specifically 2.24.0 to 2.24.4 and 2.25.0 to 2.25.2.

4

What can be compromised due to CVE-2025-58437?

CVE-2025-58437 can lead to the compromise of prebuilt workspaces through insecure session handling.

5

What component of Coder does CVE-2025-58437 affect?

CVE-2025-58437 affects the session handling mechanism in the Coder application.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203