Details
Adversarial re-read (attempts to refute)
- "`raw` content is by-design trusted, so the flags shouldn't apply." Rejected: every other content path (attachments, alternatives, html/text, icalEvent) honors the flags, and the maintainer already accepted GHSA-wqvq-jvpq-h66f for exactly this "untrusted input + flag set" model. The asymmetry — attachment
{path}is blocked butraw:{path}is not — is the bug, and the PoC's CONTROL case proves the flag is otherwise effective on the same file. - "The raw node inherits the flags via rootNode." Rejected by code and by PoC:
compile():35constructs the node with{ newline }only;MimeNodeconstructor setsthis.disableFileAccess = !!options.disableFileAccess→false;rootNodeis itself; no inheritance exists. - "The PoC leaks for an unrelated reason." Rejected: the CONTROL message (
attachments:[{path}], same file, same transporter) returnsEFILEACCESS; only theraw:{path}message leaks. The sentinel nonce exists solely in the temp file; the URL nonce is generated server-side and is only obtainable by an actual fetch. Both observables are uniquely bound to the bypass. - "Maybe only jsonTransport (already reported) is affected." Rejected: the PoC uses
streamTransportand the root cause is inMailComposer.compile()(mailer:188), shared by all transports; jsonTransport is a different (already-fixed) path.
I could not find any guard that blocks the chain; the finding survives.
Proof of concept (safe, benign)
findings/nodemailer/raw/poc-raw-fileaccess-bypass.js — local, no network egress (loopback only),
no destructive action. Output:
[CONTROL] attachment path with disableFileAccess: BLOCKED (EFILEACCESS) — flag works here
[ATTACK] raw:{path} with disableFileAccess=true: BYPASSED — sentinel file CONTENT present in message
[ATTACK] raw:{href} with disableUrlAccess=true (loopback server): BYPASSED — fetched body present (SSRF)
VERDICT: CONFIRMED
Run: node findings/nodemailer/raw/poc-raw-fileaccess-bypass.js (exit 0 = confirmed).
Remediation
Thread the access policy onto the raw root node, exactly as the other builders do:
if (this.mail.raw) {
this.message = new MimeNode('message/rfc822', {
newline: this.mail.newline,
disableFileAccess: this.mail.disableFileAccess,
disableUrlAccess: this.mail.disableUrlAccess
}).setRaw(this.mail.raw);
}
(Defense in depth: setRaw/_getStream could also refuse {path}/{href} raw content when either
flag is set, regardless of how the node was constructed.) Add a regression test asserting thatraw:{path} and raw:{href} reject with EFILEACCESS/EURLACCESS when the flags are set, mirroring
the attachment tests.