# CVE-2024-27918: Coder's OIDC authentication allows email with partially matching domain to register

> Attackers can bypass email domain restrictions to register unauthorized accounts on Coder instances using public OIDC providers.

- **Severity:** High 8.2 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Mar 2024
- **Updated:** 5 Aug 2024
- **Also known as:** GHSA-7cc2-r658-7xpf, GO-2024-2602

## What is CVE-2024-27918?

CVE-2024-27918 is a high-severity authentication bypass vulnerability in coder, published on 6 Mar 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Coder allows oragnizations to provision remote development environments via Terraform. Prior to versions 2.6.1, 2.7.3, and 2.8.4, 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. 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. An attacker could register a domain name that exploited this vulnerability and register on a Coder instance with a public OIDC provider.

Coder instances with OIDC enabled and protected by the `CODER_OIDC_EMAIL_DOMAIN` configuration are affected. 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 are impacted. GitHub authentication and external authentication are not impacted. This vulnerability is remedied in versions 2.8.4, 2.7.3, and 2.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.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2024-27918?

10 open source packages ship an affected version, including github.com/coder/coder/v2 and github.com/coder/coder. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/coder/coder/v2` | Go | All versions | 2.6.1, 2.7.3, 2.8.4 |
| `github.com/coder/coder/v2` | Go | All versions | 2.6.1 |
| `github.com/coder/coder/v2` | Go | All versions | 2.6.1 |
| `github.com/coder/coder/v2` | Go | From 2.7.0 | 2.7.3 |
| `github.com/coder/coder/v2` | Go | From 2.7.0 | 2.7.3 |
| `github.com/coder/coder/v2` | Go | From 2.8.0 | 2.8.4 |
| `github.com/coder/coder/v2` | Go | From 2.8.0 | 2.8.4 |
| `github.com/coder/coder` | Go | All versions | None |
| `github.com/coder/coder` | Go | All versions to 0.27.3 | None |
| `github.com/coder/coder` | Go | All versions to 0.27.3 | None |

Products: Coder Coder.

## How do I fix CVE-2024-27918?

Upgrade github.com/coder/coder/v2 to a fixed version for your release line: 2.6.1, 2.7.3 or 2.8.4.

## Is CVE-2024-27918 being exploited?

There is no known exploitation of CVE-2024-27918 in the wild and no public exploit code.

## Other vulnerabilities in coder

- [CVE-2026-46354](https://insights.sbomify.com/CVE-2026-46354/): Coder: PKCS#7 signature bypass in Azure instance identity allows unauthenticated agent token theft (critical 9.1)
- [CVE-2026-55429](https://insights.sbomify.com/CVE-2026-55429/): Coder's workspace app upsert allows cross-workspace agent rebinding via user-controlled app ID (high 8.7)
- [CVE-2026-55427](https://insights.sbomify.com/CVE-2026-55427/): Coder vulnerable to SSH config injection via unsanitized server-supplied values in `coder config-ssh` (high 8.3)
- [CVE-2026-55428](https://insights.sbomify.com/CVE-2026-55428/): Coder: Route hijacking through lack of validation of agent-supplied AllowedIPs in tailnet coordinator (high 8.2)
- [CVE-2026-44454](https://insights.sbomify.com/CVE-2026-44454/): Coder vulnerable to workspace auto-creation via crafted URL parameters without user consent (high 8.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-27918 and fix it if it is affected.

What it is: CVE-2024-27918 is a high-severity authentication bypass vulnerability in coder, published on 6 Mar 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-27918 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/coder/coder/v2 (Go): affected all versions; fixed in 2.6.1, 2.7.3, 2.8.4
- github.com/coder/coder/v2 (Go): affected all versions; fixed in 2.6.1
- github.com/coder/coder/v2 (Go): affected all versions; fixed in 2.6.1
- github.com/coder/coder/v2 (Go): affected from 2.7.0; fixed in 2.7.3
- github.com/coder/coder/v2 (Go): affected from 2.7.0; fixed in 2.7.3
- github.com/coder/coder/v2 (Go): affected from 2.8.0; fixed in 2.8.4
- github.com/coder/coder/v2 (Go): affected from 2.8.0; fixed in 2.8.4
- github.com/coder/coder (Go): affected all versions; no fix listed
- github.com/coder/coder (Go): affected all versions up to 0.27.3; no fix listed
- github.com/coder/coder (Go): affected all versions up to 0.27.3; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-27918/ (Markdown: https://insights.sbomify.com/CVE-2024-27918/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-27918
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-27918
- OSV: https://osv.dev/vulnerability/CVE-2024-27918

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-27918/
Summaries are generated and may contain mistakes; the official description above is the record.
