# CVE-2026-42790: nameConstraints DNS bypass via subject CommonName fallback in public_key hostname verification

> Attackers can bypass TLS hostname verification in Erlang OTP by exploiting a CommonName fallback flaw, allowing impersonation of restricted domains.

- **Severity:** High 7.6 (`CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 27 May 2026
- **Updated:** 18 Sep 2026
- **Also known as:** AZL-89175, DEBIAN-CVE-2026-42790, EEF-CVE-2026-42790, GHSA-22cw-4ph4-6447, UBUNTU-CVE-2026-42790

## What is CVE-2026-42790?

CVE-2026-42790 is a high-severity vulnerability in Erlang OTP, published on 27 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Improper Certificate Validation vulnerability in Erlang OTP public_key (pubkey_cert and public_key modules) allows a DNS nameConstraints bypass via subject CommonName fallback in TLS hostname verification.

Two flaws combine to allow a subordinate CA whose DNS nameConstraints are restricted (e.g. permitted;DNS:allowed.example.com) to issue a leaf certificate that an OTP TLS client accepts as a valid identity for an out-of-scope hostname (e.g. victim.example.com):

First, pubkey_cert:validate_names/6 in lib/public_key/src/pubkey_cert.erl only checks SAN DNS entries against nameConstraints. Per RFC 5280, a permitted DNS subtree only restricts certificates that contain a DNS-typed name. A leaf with no subjectAltName therefore trivially satisfies any permitted;DNS:... constraint regardless of its subject commonName.

Second, public_key:pkix_verify_hostname/3 in lib/public_key/src/public_key.erl falls back to the subject commonName when no subjectAltName is present, extracting id-at-commonName attributes as presented IDs and matching them against the reference hostname. The strict pkix_verify_hostname_match_fun(https) matcher does not suppress this fallback.

The result is that path validation accepts a CN-only leaf under a DNS-constrained intermediate (no SAN means the nameConstraints are not triggered), and hostname verification then accepts it via the CN fallback. The bypass is reachable from stock ssl:connect with verify_peer, a trusted CA, SNI, and the canonical strict https hostname matcher.

This issue affects OTP from OTP 19.3 before OTP 29.0.1, OTP 28.5.0.1, OTP 27.3.4.12 and OTP 26.2.5.21, corresponding to public_key from 1.4 before 1.21.1, 1.20.3.1, 1.17.1.3 and 1.15.1.7.

Weakness: CWE-297 (Improper Validation of Certificate with Host Mismatch), CWE-295 (Improper Certificate Validation)

## Which versions are affected by CVE-2026-42790?

It affects 1 product.


Products: Erlang Erlang\/Otp.

## How do I fix CVE-2026-42790?

Upgrade to a fixed version.

## Is CVE-2026-42790 being exploited?

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

## Other vulnerabilities in Erlang OTP

- [CVE-2022-37026](https://insights.sbomify.com/CVE-2022-37026/): Auth bypass in n/a (critical 9.8)
- [CVE-2016-10253](https://insights.sbomify.com/CVE-2016-10253/): Memory corruption in n/a (critical 9.8)
- [CVE-2026-55953](https://insights.sbomify.com/CVE-2026-55953/): TLS 1.2 and DTLS client accepts unoffered anonymous cipher suite, bypassing server authentication (critical 9.1)
- [CVE-2026-49759](https://insights.sbomify.com/CVE-2026-49759/): Stack buffer overflow in SCTP error cause parsing in inet_drv allows remote VM crash (high 8.8)
- [CVE-2026-58227](https://insights.sbomify.com/CVE-2026-58227/): TLS/DTLS denial of service via unbounded recursion on cross-signed peer certificate chain (high 8.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-42790 and fix it if it is affected.

What it is: CVE-2026-42790 is a high-severity vulnerability in Erlang OTP, published on 27 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-42790 in the wild and no public exploit code.

Affected product: Erlang OTP. No package-level version data is available, so check the vendor advisory linked from the reference page.

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-2026-42790/ (Markdown: https://insights.sbomify.com/CVE-2026-42790/index.md)
```

## Sources

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

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