CVE-2026-46428: Lettre Lettre Has TLS Hostname Verification Vulnerability

CRITICAL
Advisory Identifier: GHSA-4pj9-g833-qx53
CWE-295
Published
Advisory Summary

CVE-2026-46428 is a CRITICAL lettre has tls hostname verification vulnerability (CWE-295: Improper Certificate Validation) affecting Lettre libraries in the crates.io ecosystem. The issue involves lettre has tls hostname verification disabled when using boring tls backend. Remediation is available by upgrading affected packages to version 0.11.22.

CVE-2026-46428 at a Glance

CVE Identifier CVE-2026-46428
GHSA Identifier GHSA-4pj9-g833-qx53
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-295: Improper Certificate Validation
Affected Product Lettre
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix CVE-2026-46428

To remediate this vulnerability, upgrade all affected Lettre dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

lettre fixed: 0.11.22
Upgrade lettre to 0.11.22
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 lettre

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-46428, inspect your project dependencies for Lettre:

inspect dependencies for lettre

Analyze the terminal output to locate any version of Lettre in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.11.22), 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-295: Improper Certificate Validation, where the product does not validate, or incorrectly validates, a certificate. In Lettre, 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 An inverted-boolean bug in lettre's `boring-tls` integration silently disables TLS hostname verification for callers using the default (strict) configuration. An on-path attacker presenting any chain-valid certificate for any domain can intercept SMTP submission, including PLAIN/LOGIN credentials and message contents, against any lettre user built with the `boring-tls` feature. Other TLS backends (`native-tls`, `rustls`) are unaffected. ### Details boring's `SslConnectorBuilder::set_verify_hostname(bool)` / `verify_hostname(bool)` API takes a *verify* flag — `true` means enforce hostname verification, `false` means skip it. (Boring docs: https://docs.rs/boring/latest/boring/ssl/struct.ConnectConfiguration.html#method.set_verify_hostname) lettre's `TlsParametersBuilder` exposes the opposite-named flag `accept_invalid_hostnames: bool` — `true` means *accept invalid* (skip verification), `false` means verify. lettre passes this flag directly to boring at both TLS-upgrade sites, inverting the semantics: src/transport/smtp/client/net.rs:202 (sync) .verify_hostname(*accept_invalid_hostnames) src/transport/smtp/client/async_net.rs:377 (async) config.set_verify_hostname(accept_invalid_hostnames); Concrete behaviour under `boring-tls`: * accept_invalid_hostnames = false (the strict default) → set_verify_hostname(false) → hostname verification SKIPPED (wrong; the caller asked for strict verification) * accept_invalid_hostnames = true (explicit opt-in to "dangerous") → set_verify_hostname(true) → hostname verification ENFORCED (wrong; the caller opted into accepting any name) Boring's own warning on `set_verify_hostname`: "If hostname verification is not used, *any* valid certificate for *any* site will be trusted for use from any other. This introduces a significant vulnerability to man-in-the-middle attacks." `native-tls` (src/transport/smtp/client/tls.rs:355) uses `danger_accept_invalid_hostnames(self.accept_invalid_hostnames)`, whose flag name and semantics match lettre's — unaffected. `rustls` uses a separate verifier path — unaffected. The bug was introduced in PR #797 ("Add support for boring TLS"), commit 985fa7e, first released in v0.10.1, and persists unchanged through v0.11.21 (latest). Zero existing tests cover `accept_invalid_hostnames` end-to-end with any backend, which is why the inversion has gone undetected. Fix: negate the flag at both call sites. Two-line patch: - .verify_hostname(*accept_invalid_hostnames) + .verify_hostname(!*accept_invalid_hostnames) - config.set_verify_hostname(accept_invalid_hostnames); + config.set_verify_hostname(!accept_invalid_hostnames); I have the patch ready locally and can push to a private fork if a collaborative fix branch is preferred. ### PoC Setup (any lettre version >= v0.10.1, built with the `boring-tls` feature, default-strict configuration): 1. Generate a TLS cert for any hostname the attacker controls, e.g. `attacker.example`, signed by any CA in the client's trust store (e.g. a Let's Encrypt cert is sufficient). 2. Stand up an attacker SMTP server on the network path between the lettre client and the intended MX. Have it present the `attacker.example` cert on STARTTLS or implicit TLS. 3. Use lettre with default-strict TLS to send to the real MX hostname, e.g. `mail.example.com`: use lettre::transport::smtp::client::{Tls, TlsParameters}; use lettre::{AsyncSmtpTransport, Tokio1Executor, Message}; let tls = TlsParameters::builder("mail.example.com".to_owned()) .build_boring() .unwrap(); let mailer = AsyncSmtpTransport::<Tokio1Executor>::relay( "mail.example.com", )? .tls(Tls::Required(tls)) .build(); mailer.send(message).await?; // succeeds against attacker Expected with hostname verification: handshake fails because the presented leaf cert's SAN does not match `mail.example.com`. Actual on `boring-tls`: handshake succeeds. lettre proceeds with the SMTP transaction, sending MAIL FROM, RCPT TO, message body, and any configured SMTP AUTH credentials to the attacker. Symmetric inverse PoC (proves the inversion, not just a missing check): configure `.dangerous_accept_invalid_hostnames(true)` and try to connect to a server whose cert SAN matches the connect domain. With the bug, the handshake *fails* because lettre passes `true` to `verify_hostname` and boring rejects... actually wait, it succeeds (SAN matches). Better inverse demonstration: connect to a server whose cert SAN matches the connect domain with `accept_invalid_hostnames=true`, then connect to a mismatched-SAN server with the same flag — the latter is rejected, proving the flag is inverted (the user opted into accepting any name, yet lettre enforces strict verification). A reproducer cargo project can be produced on request. ### Impact Who is impacted: any lettre user who 1. enables the `boring-tls` feature, AND 2. relies on default-strict hostname verification (i.e. does NOT call `.dangerous_accept_invalid_hostnames(true)`). This is the entire "I want strict TLS" population on `boring-tls`. They get the opposite of what they asked for: a TLS handshake that ignores hostname mismatch. Exploitation: an attacker on the network path between the lettre client and the target SMTP server, holding any chain-valid TLS certificate (e.g. a free Let's Encrypt cert for a domain the attacker owns), can present that certificate when the lettre client connects to the intended MX. boring accepts the handshake, lettre proceeds, and the attacker gains read/write access to: * SMTP envelope (MAIL FROM, RCPT TO) * Message bodies, attachments, headers * Any SMTP AUTH credentials (PLAIN, LOGIN, CRAM-MD5, etc.) * Any DKIM signatures and DMARC alignment downstream depends on can be inspected and selectively dropped Confidentiality and integrity impact: High. Availability impact: None direct (the attacker can choose to forward or drop, but the bug itself does not deny service). Cloudflare's email-fwdr independently identified and mitigated this downstream by promoting a previously-metric-only post-handshake SAN check to a hard error (fix landed 2026-05-12). Because we're mitigated downstream, we are not on a publication clock; we are reporting so the upstream fix can ship and other lettre+boring-tls deployments can stop relying on per-caller workarounds. Happy to coordinate on embargo timing. Affected versions: every released lettre version with `boring-tls` support, from v0.10.1 (PR #797, commit 985fa7e) through v0.11.21 (latest). No prior advisory or fix. Suggested fix: two-line negation of the flag at the boring call sites (see Details). Patch is ready locally and can be attached to a private collaboration fork.

CVE-2026-46428 Affected Lettre Versions

1 component(s)
Fixed Versions:
0.11.22
Product / Package Ecosystem Affected Versions Fixed Version
lettre
crates.io
≥ 0.10.1
< 0.11.22
0.11.22

References

Frequently Asked Questions

What is CVE-2026-46428?
CVE-2026-46428 is a security vulnerability in Lettre involving lettre has TLS hostname verification disabled when using Boring TLS backend under CWE-295: Improper Certificate Validation.
Which Lettre versions are affected?
Affected versions include releases prior to 0.11.22 across affected packages: lettre.
What version fixes CVE-2026-46428?
Upgrading to 0.11.22 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lettre affected?
Yes, lettre is affected in releases prior to 0.11.22. Upgrade your dependency to 0.11.22 or later.
What CWE is associated with CVE-2026-46428?
CVE-2026-46428 is classified under CWE-295: Improper Certificate Validation (The product does not validate, or incorrectly validates, a certificate.).
How can I check crates.io dependencies for CVE-2026-46428?
Run the dependency tree command: 'inspect dependencies for lettre'. 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-4pj9-g833-qx53",
  "modified" : "2026-07-28T14:29:10Z",
  "published" : "2026-07-28T14:29:10Z",
  "aliases" : [ "CVE-2026-46428" ],
  "summary" : "lettre has TLS hostname verification disabled when using Boring TLS backend",
  "details" : "### Summary\nAn inverted-boolean bug in lettre's `boring-tls` integration silently\ndisables TLS hostname verification for callers using the default (strict)\nconfiguration. An on-path attacker presenting any chain-valid certificate\nfor any domain can intercept SMTP submission, including PLAIN/LOGIN\ncredentials and message contents, against any lettre user built with the\n`boring-tls` feature. Other TLS backends (`native-tls`, `rustls`) are\nunaffected.\n\n### Details\nboring's `SslConnectorBuilder::set_verify_hostname(bool)` /\n`verify_hostname(bool)` API takes a *verify* flag — `true` means enforce\nhostname verification, `false` means skip it. (Boring docs:\nhttps://docs.rs/boring/latest/boring/ssl/struct.ConnectConfiguration.html#method.set_verify_hostname)\nlettre's `TlsParametersBuilder` exposes the opposite-named flag\n`accept_invalid_hostnames: bool` — `true` means *accept invalid* (skip\nverification), `false` means verify. lettre passes this flag directly to\nboring at both TLS-upgrade sites, inverting the semantics:\nsrc/transport/smtp/client/net.rs:202 (sync)\n    .verify_hostname(*accept_invalid_hostnames)\nsrc/transport/smtp/client/async_net.rs:377 (async)\n    config.set_verify_hostname(accept_invalid_hostnames);\nConcrete behaviour under `boring-tls`:\n  * accept_invalid_hostnames = false  (the strict default)\n      → set_verify_hostname(false)  → hostname verification SKIPPED\n        (wrong; the caller asked for strict verification)\n  * accept_invalid_hostnames = true   (explicit opt-in to \"dangerous\")\n      → set_verify_hostname(true)   → hostname verification ENFORCED\n        (wrong; the caller opted into accepting any name)\nBoring's own warning on `set_verify_hostname`:\n    \"If hostname verification is not used, *any* valid certificate for\n    *any* site will be trusted for use from any other. This introduces\n    a significant vulnerability to man-in-the-middle attacks.\"\n`native-tls` (src/transport/smtp/client/tls.rs:355) uses\n`danger_accept_invalid_hostnames(self.accept_invalid_hostnames)`, whose\nflag name and semantics match lettre's — unaffected. `rustls` uses a\nseparate verifier path — unaffected.\nThe bug was introduced in PR #797 (\"Add support for boring TLS\"), commit\n985fa7e, first released in v0.10.1, and persists unchanged through v0.11.21\n(latest). Zero existing tests cover `accept_invalid_hostnames` end-to-end\nwith any backend, which is why the inversion has gone undetected.\nFix: negate the flag at both call sites. Two-line patch:\n    -    .verify_hostname(*accept_invalid_hostnames)\n    +    .verify_hostname(!*accept_invalid_hostnames)\n    -    config.set_verify_hostname(accept_invalid_hostnames);\n    +    config.set_verify_hostname(!accept_invalid_hostnames);\nI have the patch ready locally and can push to a private fork if a\ncollaborative fix branch is preferred.\n\n### PoC\nSetup (any lettre version >= v0.10.1, built with the `boring-tls`\nfeature, default-strict configuration):\n1. Generate a TLS cert for any hostname the attacker controls, e.g.\n   `attacker.example`, signed by any CA in the client's trust store\n   (e.g. a Let's Encrypt cert is sufficient).\n2. Stand up an attacker SMTP server on the network path between the\n   lettre client and the intended MX. Have it present the\n   `attacker.example` cert on STARTTLS or implicit TLS.\n3. Use lettre with default-strict TLS to send to the real MX hostname,\n   e.g. `mail.example.com`:\n       use lettre::transport::smtp::client::{Tls, TlsParameters};\n       use lettre::{AsyncSmtpTransport, Tokio1Executor, Message};\n       let tls = TlsParameters::builder(\"mail.example.com\".to_owned())\n           .build_boring()\n           .unwrap();\n       let mailer = AsyncSmtpTransport::<Tokio1Executor>::relay(\n               \"mail.example.com\",\n           )?\n           .tls(Tls::Required(tls))\n           .build();\n       mailer.send(message).await?;     // succeeds against attacker\nExpected with hostname verification: handshake fails because the\npresented leaf cert's SAN does not match `mail.example.com`.\nActual on `boring-tls`: handshake succeeds. lettre proceeds with the\nSMTP transaction, sending MAIL FROM, RCPT TO, message body, and any\nconfigured SMTP AUTH credentials to the attacker.\nSymmetric inverse PoC (proves the inversion, not just a missing check):\nconfigure `.dangerous_accept_invalid_hostnames(true)` and try to connect\nto a server whose cert SAN matches the connect domain. With the bug,\nthe handshake *fails* because lettre passes `true` to `verify_hostname`\nand boring rejects... actually wait, it succeeds (SAN matches). Better\ninverse demonstration: connect to a server whose cert SAN matches the\nconnect domain with `accept_invalid_hostnames=true`, then connect to a\nmismatched-SAN server with the same flag — the latter is rejected,\nproving the flag is inverted (the user opted into accepting any name,\nyet lettre enforces strict verification).\nA reproducer cargo project can be produced on request.\n\n### Impact\nWho is impacted: any lettre user who\n  1. enables the `boring-tls` feature, AND\n  2. relies on default-strict hostname verification\n     (i.e. does NOT call `.dangerous_accept_invalid_hostnames(true)`).\nThis is the entire \"I want strict TLS\" population on `boring-tls`. They\nget the opposite of what they asked for: a TLS handshake that ignores\nhostname mismatch.\nExploitation: an attacker on the network path between the lettre client\nand the target SMTP server, holding any chain-valid TLS certificate\n(e.g. a free Let's Encrypt cert for a domain the attacker owns), can\npresent that certificate when the lettre client connects to the intended\nMX. boring accepts the handshake, lettre proceeds, and the attacker\ngains read/write access to:\n  * SMTP envelope (MAIL FROM, RCPT TO)\n  * Message bodies, attachments, headers\n  * Any SMTP AUTH credentials (PLAIN, LOGIN, CRAM-MD5, etc.)\n  * Any DKIM signatures and DMARC alignment downstream depends on\n    can be inspected and selectively dropped\nConfidentiality and integrity impact: High. Availability impact: None\ndirect (the attacker can choose to forward or drop, but the bug itself\ndoes not deny service).\nCloudflare's email-fwdr independently identified and mitigated this\ndownstream by promoting a previously-metric-only post-handshake SAN\ncheck to a hard error (fix landed 2026-05-12). Because we're mitigated\ndownstream, we are not on a publication clock; we are reporting so the\nupstream fix can ship and other lettre+boring-tls deployments can stop\nrelying on per-caller workarounds. Happy to coordinate on embargo\ntiming.\nAffected versions: every released lettre version with `boring-tls`\nsupport, from v0.10.1 (PR #797, commit 985fa7e) through v0.11.21\n(latest). No prior advisory or fix.\nSuggested fix: two-line negation of the flag at the boring call sites\n(see Details). Patch is ready locally and can be attached to a private\ncollaboration fork.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "lettre"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.10.1"
      }, {
        "fixed" : "0.11.22"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lettre/lettre/security/advisories/GHSA-4pj9-g833-qx53"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-46428"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lettre/lettre/commit/f5efffc88360dbdbfcef80f465e42d5bce68ca35"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lettre/lettre"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lettre/lettre/releases/tag/v0.11.22"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2026-0141.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-295" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-28T14:29:10Z",
    "nvd_published_at" : "2026-07-20T16:17:01Z"
  }
}