CVE-2025-58437: Github.com/coder/coder/v2 Coder Vulnerable To Privilege Escalation Vulnerability
HIGHCVE-2025-58437 is a HIGH (CVSS 8.1) coder vulnerable to privilege escalation vulnerability (CWE-613: Insufficient Session Expiration) affecting Github.com/coder/coder/v2 libraries in the Go ecosystem. The issue involves coder vulnerable to privilege escalation could lead to a cross workspace compromise. Remediation is available by upgrading affected packages to version 2.24.4, 2.25.2.
CVE-2025-58437 at a Glance
Security Impact
CVSS: 8.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N).
How to Fix CVE-2025-58437
To remediate this vulnerability, upgrade all affected Github.com/coder/coder/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/coder/coder/v2 to 2.24.4
Upgrade github.com/coder/coder/v2 to 2.25.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/coder/coder/v2
How to Check if You Are Affected
To determine whether your application is affected by CVE-2025-58437, inspect your project dependencies for Github.com/coder/coder/v2:
inspect dependencies for github.com/coder/coder/v2
Analyze the terminal output to locate any version of Github.com/coder/coder/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.24.4), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-613: Insufficient Session Expiration, where according to wasc, "insufficient session expiration is when a web site permits an attacker to reuse old session credentials or session ids for authorization.". In Github.com/coder/coder/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-58437 Affected Github.com/coder/coder/v2 Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/coder/coder/v2
|
Go |
≥ 2.22.0
< 2.24.4
|
2.24.4
|
|
github.com/coder/coder/v2
|
Go |
≥ 2.25.0
< 2.25.2
|
2.25.2
|
References
Frequently Asked Questions
What is CVE-2025-58437?
Which Github.com/coder/coder/v2 versions are affected?
What version fixes CVE-2025-58437?
Is github.com/coder/coder/v2 affected?
What is the CVSS score of CVE-2025-58437?
What CWE is associated with CVE-2025-58437?
How can I check Go dependencies for CVE-2025-58437?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-j6xf-jwrj-v5qp",
"modified" : "2025-09-10T20:50:29Z",
"published" : "2025-09-05T20:19:58Z",
"aliases" : [ "CVE-2025-58437" ],
"summary" : "Coder vulnerable to privilege escalation could lead to a cross workspace compromise",
"details" : "## Summary\n\nInsecure session handling opened room for a privilege escalation scenario in which [prebuilt workspaces](https://coder.com/docs/admin/templates/extending-templates/prebuilt-workspaces) could be compromised by abusing a shared system identity.\n\n## Details\n\nCoder automatically generates a session token for a user when a workspace is started. It is automatically exposed via [`coder_workspace_owner.session_token`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace_owner#session_token-1). Prebuilt workspaces are initially owned by a built-in `prebuilds` system user. \n\nWhen 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. \n\nFor example, the [coder-login module](https://github.com/coder/registry/blob/8677e7d52b374b025c4820d09049dc6b008beee8/registry/coder/modules/coder-login/run.sh) allows template authors to automatically configure the coder CLI to be authenticated with the Coder deployment.\n\nThis 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](https://github.com/coder/registry/blob/8677e7d52b374b025c4820d09049dc6b008beee8/registry/coder/modules/coder-login/main.tf#L23)\n\nThis module was originally written before the inception of the [prebuilds](https://coder.com/docs/admin/templates/extending-templates/prebuilt-workspaces) feature in Coder, which essentially creates a \"pre-warmed\" pool of workspaces owned by a particular `prebuilds` system user.\n\nWhen 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 `prebuilds`user upon claim:\n\n## Impact\n\n> Important: **Deployments that have never utilized the [prebuilds](https://coder.com/docs/admin/templates/extending-templates/prebuilt-workspaces) feature are not affected by this vulnerability.**\n\n\nThis 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.\n\nThe `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.\n\nThis 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.\n\n\n## Remediation\n\nFixed in https://github.com/coder/coder/pull/19667\n\nNote 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.\n\nTo identify potentially affected workspaces, run the following SQL query against the Coder database:\n\n```sql\nSELECT w.id, w.name, w.owner_id, u.email\nFROM workspaces w\nLEFT JOIN users u ON u.id = w.owner_id\nWHERE w.owner_id <> 'c42fdf75-3097-471c-8c33-fb52454d81c0'::uuid\n AND NOT w.deleted\n AND EXISTS (\n SELECT 1\n FROM workspace_builds AS wb\n WHERE wb.workspace_id = w.id\n AND wb.initiator_id = 'c42fdf75-3097-471c-8c33-fb52454d81c0'::uuid\n );\n```\n\n> Previous manually created tokens for the prebuilds user are left as-is. You may wish to review these via `coder tokens list --all`\n\n---\n\n[Premium license](https://coder.com/docs/admin/licensing) customers can also take advantage of the [audit logs](https://coder.com/docs/admin/security/audit-logs) feature to query actions performed by the `prebuilds` user.\n\nFollowing [filter](https://coder.com/docs/admin/security/audit-logs#how-to-filter-audit-logs) can be used to verify if no [API keys](https://coder.com/docs/reference/api/users#create-token-api-key) were created by the `prebuilds` user\n> would indicate a potentially malicious action aimed at achieving [persistence](https://attack.mitre.org/tactics/TA0003/)\n```\nusername:prebuilds resource_type:api_key\n```\n\nFollowing [filter](https://coder.com/docs/admin/security/audit-logs#how-to-filter-audit-logs) can be used to list all *write* operations performed by the `prebuilds` user (including failed attempts to update various settings)\n```\nusername:prebuilds action:write\n```\n\n### Patched versions\n- [2.24.4](https://github.com/coder/coder/releases/tag/v2.24.4)\n- [2.25.2](https://github.com/coder/coder/releases/tag/v2.25.2)\n- [2.26.0](https://github.com/coder/coder/releases/tag/v2.26.0)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/coder/coder/v2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.22.0"
}, {
"fixed" : "2.24.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/coder/coder/v2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.25.0"
}, {
"fixed" : "2.25.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/coder/coder/security/advisories/GHSA-j6xf-jwrj-v5qp"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-58437"
}, {
"type" : "WEB",
"url" : "https://github.com/coder/coder/pull/19667"
}, {
"type" : "WEB",
"url" : "https://github.com/coder/coder/pull/19668"
}, {
"type" : "WEB",
"url" : "https://github.com/coder/coder/pull/19669"
}, {
"type" : "WEB",
"url" : "https://github.com/coder/coder/commit/06cbb2890f453cd522bb2158a6549afa3419c276"
}, {
"type" : "WEB",
"url" : "https://github.com/coder/coder/commit/20d67d7d7191a4fd5d36a61c6fc1e23ab59befc0"
}, {
"type" : "WEB",
"url" : "https://github.com/coder/coder/commit/ec660907faa0b0eae20fa2ba58ce1733f5f4b35a"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/coder/coder"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-269", "CWE-277", "CWE-613" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-09-05T20:19:58Z",
"nvd_published_at" : "2025-09-06T03:15:40Z"
}
}