CVE-2024-27918: Github.com/coder/coder/v2 Coder's OIDC Authentication Allows Email Vulnerability

HIGH
Advisory Identifier: GHSA-7cc2-r658-7xpf
CVSS 8.2
CWE-20
Published
Advisory Summary

CVE-2024-27918 is a HIGH (CVSS 8.2) coder's oidc authentication allows email vulnerability (CWE-20: Improper Input Validation) affecting Github.com/coder/coder/v2 libraries in the Go ecosystem. The issue involves coder's oidc authentication allows email with partially matching domain to register. Remediation is available by upgrading affected packages to version 2.8.4, 2.7.3, 2.6.1.

CVE-2024-27918 at a Glance

CVE Identifier CVE-2024-27918
GHSA Identifier GHSA-7cc2-r658-7xpf
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-20: Improper Input Validation
Affected Product Github.com/coder/coder/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2024-27918

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.

github.com/coder/coder/v2 fixed: 2.8.4
Upgrade github.com/coder/coder/v2 to 2.8.4
github.com/coder/coder/v2 fixed: 2.7.3
Upgrade github.com/coder/coder/v2 to 2.7.3
github.com/coder/coder/v2 fixed: 2.6.1
Upgrade github.com/coder/coder/v2 to 2.6.1
github.com/coder/coder fixed: Latest secure release
Upgrade github.com/coder/coder to Latest secure release
Verify Direct and Transitive Dependencies

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-2024-27918, 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.8.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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. 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

### Summary A vulnerability in Coder's OIDC authentication could allow an attacker to bypass the `CODER_OIDC_EMAIL_DOMAIN` verification and create an account with an email not in the allowlist. Deployments are only affected if the OIDC provider allows users to create accounts on the provider (such as public providers like `google.com`). ### Details During OIDC registration, the user's email was improperly validated against the allowed `CODER_OIDC_EMAIL_DOMAIN`s. This could allow a user with a domain that only partially matched an allowed domain to successfully login or register (e.g. `user@exploitcorp.com` would match the allowed domain `corp.com`). An attacker could register a domain name that exploited this vulnerability and register on a Coder instance with a public OIDC provider. ### Impact Coder instances with OIDC enabled and protected by the `CODER_OIDC_EMAIL_DOMAIN` configuration. Coder instances using a private OIDC provider are not affected, as arbitrary users cannot register through a private OIDC provider without first having an account on the provider. Public OIDC providers (such as `google.com` without permitted domains set on the OAuth2 App) are impacted. GitHub authentication and external authentication are not impacted. ### Was my deployment impacted? To check if your deployment was exploited: - View the audit log on your deployment for unexpected registered users (using the `action:register` filter) - Check the users list for unexpected users - Users created via this exploit will have a domain that ends with one of the allowed domains but doesn’t fully match (e.g. `@exploitcorp.com` instead of `@corp.com`) ### Patched Versions This vulnerability is remedied in - v2.8.4 - v2.7.3 - v2.6.1 All versions prior to these patches are affected by the vulnerability. **It is recommended that customers upgrade their deployments as soon as possible if they are utilizing OIDC authentication with the `CODER_OIDC_EMAIL_DOMAIN` setting.** ### Thanks - https://github.com/arcz - https://www.trailofbits.com ### References https://github.com/coder/coder/security/advisories/GHSA-7cc2-r658-7xpf https://github.com/coder/coder/commit/4439a920e454a82565e445e4376c669e3b89591c https://nvd.nist.gov/vuln/detail/CVE-2024-27918

CVE-2024-27918 Affected Github.com/coder/coder/v2 Versions

4 component(s)
Fixed Versions:
2.8.42.7.32.6.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/coder/coder/v2
Go
≥ 2.8.0
< 2.8.4
2.8.4
github.com/coder/coder/v2
Go
≥ 2.7.0
< 2.7.3
2.7.3
github.com/coder/coder/v2
Go
< 2.6.1
2.6.1
github.com/coder/coder
Go
≤ 0.27.3

References

Frequently Asked Questions

What is CVE-2024-27918?
CVE-2024-27918 is a security vulnerability in Github.com/coder/coder/v2 involving Coder's OIDC authentication allows email with partially matching domain to register under CWE-20: Improper Input Validation.
Which Github.com/coder/coder/v2 versions are affected?
Affected versions include releases prior to 2.8.4, 2.7.3, 2.6.1 across affected packages: github.com/coder/coder/v2, github.com/coder/coder.
What version fixes CVE-2024-27918?
Upgrading to 2.8.4, 2.7.3, 2.6.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/coder/coder/v2 affected?
Yes, github.com/coder/coder/v2 is affected in releases prior to 2.8.4, 2.7.3, 2.6.1. Upgrade your dependency to 2.8.4, 2.7.3, 2.6.1 or later.
Is github.com/coder/coder affected?
Yes, github.com/coder/coder is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2024-27918?
CVE-2024-27918 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H.
What CWE is associated with CVE-2024-27918?
CVE-2024-27918 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Go dependencies for CVE-2024-27918?
Run the dependency tree command: 'inspect dependencies for github.com/coder/coder/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7cc2-r658-7xpf",
  "modified" : "2024-03-21T18:29:31Z",
  "published" : "2024-03-04T20:45:36Z",
  "aliases" : [ "CVE-2024-27918" ],
  "summary" : "Coder's OIDC authentication allows email with partially matching domain to register",
  "details" : "### Summary\nA vulnerability in Coder's OIDC authentication could allow an attacker to bypass the `CODER_OIDC_EMAIL_DOMAIN` verification and create an account with an email not in the allowlist. Deployments are only affected if the OIDC provider allows users to create accounts on the provider (such as public providers like `google.com`).\n\n### Details\nDuring OIDC registration, the user's email was improperly validated against the allowed `CODER_OIDC_EMAIL_DOMAIN`s. This could allow a user with a domain that only partially matched an allowed domain to successfully login or register (e.g. `user@exploitcorp.com` would match the allowed domain `corp.com`).\n\nAn attacker could register a domain name that exploited this vulnerability and register on a Coder instance with a public OIDC provider.\n\n### Impact\nCoder instances with OIDC enabled and protected by the `CODER_OIDC_EMAIL_DOMAIN` configuration.\n\nCoder instances using a private OIDC provider are not affected, as arbitrary users cannot register through a private OIDC provider without first having an account on the provider.\n\nPublic OIDC providers (such as `google.com` without permitted domains set on the OAuth2 App) are impacted.\n\nGitHub authentication and external authentication are not impacted.\n\n### Was my deployment impacted?\nTo check if your deployment was exploited:\n- View the audit log on your deployment for unexpected registered users (using the `action:register` filter)\n- Check the users list for unexpected users\n    - Users created via this exploit will have a domain that ends with one of the allowed domains but doesn’t fully match (e.g. `@exploitcorp.com` instead of `@corp.com`)\n\n### Patched Versions\nThis vulnerability is remedied in\n- v2.8.4\n- v2.7.3\n- v2.6.1\n\nAll versions prior to these patches are affected by the vulnerability. **It is recommended that customers upgrade their deployments as soon as possible if they are utilizing OIDC authentication with the `CODER_OIDC_EMAIL_DOMAIN` setting.**\n\n### Thanks\n- https://github.com/arcz\n- https://www.trailofbits.com\n\n### References\nhttps://github.com/coder/coder/security/advisories/GHSA-7cc2-r658-7xpf\nhttps://github.com/coder/coder/commit/4439a920e454a82565e445e4376c669e3b89591c\nhttps://nvd.nist.gov/vuln/detail/CVE-2024-27918",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/coder/coder/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.0"
      }, {
        "fixed" : "2.8.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/coder/coder/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.7.0"
      }, {
        "fixed" : "2.7.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/coder/coder/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.6.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/coder/coder"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.27.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/coder/coder/security/advisories/GHSA-7cc2-r658-7xpf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-27918"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/coder/coder/commit/1171ce7add017481d28441575024209ac160ecb0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/coder/coder/commit/2ba84911f8b02605e5958d5e4a2fe3979ec50b31"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/coder/coder/commit/2d37eb42e7db656e343fe1f36de5ab1a1a62f4fb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/coder/coder/commit/4439a920e454a82565e445e4376c669e3b89591c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/coder/coder"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-04T20:45:36Z",
    "nvd_published_at" : "2024-03-21T02:52:20Z"
  }
}