nodemailer
Affected
- introduced
0, fixed8.0.9(semver)
Fixed versions
8.0.9
Fix
- Fixed version
8.0.9npm install [email protected]
Advisory
Also known as: CVE-2026-82660
Nodemailer jsonTransport bypasses disableFileAccess and disableUrlAccess during message normalization
Summary
Nodemailer's disableFileAccess and disableUrlAccess options are intended to prevent message content and attachments from reading local files or fetching URLs. The normal MIME streaming path enforces those options in MimeNode._getStream(). However, jsonTransport serializes messages by calling mail.normalize(), which resolves html, text, alternatives, calendar events, and attachments through shared.resolveContent() before MIME generation. shared.resolveContent() reads local files and fetches HTTP(S) URLs directly, without receiving or checking disableFileAccess or disableUrlAccess.
As a result, applications that use jsonTransport as a safe serializer or queue payload generator while relying on disableFileAccess / disableUrlAccess can still be made to read local files into the generated JSON output or make outbound HTTP requests when an attacker controls message content fields such as attachment path or text.href.
The same missing-enforcement root cause is also reachable before normal streaming when attachDataUrls causes _convertDataImages() to call mail.resolveContent(mail.data, 'html', ...); this should be fixed with the same access-control check.
Details
Source-to-sink evidence:
lib/nodemailer.js:42-45 selects JSONTransport when createTransport({ jsonTransport: true, ... }) is used.lib/mailer/mail-message.js:34-39 copies transport-level disableFileAccess and disableUrlAccess options into mail.data.lib/json-transport/index.js:52-76 serializes mail by calling mail.normalize((err, data) => ...).lib/mailer/mail-message.js:46-135 implements resolveAll() and calls shared.resolveContent(...args, ...) for html, text, watchHtml, amp, icalEvent, alternatives, and attachments.lib/shared/index.js:506-562 implements resolveContent().lib/shared/index.js:540-541 fetches HTTP(S) content with nmfetch(content.path || content.href).lib/shared/index.js:549-550 reads local files with fs.createReadStream(content.path).shared.resolveContent() does not check disableFileAccess or disableUrlAccess and does not receive those flags.Control path showing intended enforcement:
lib/mail-composer/index.js:358-359, lib/mail-composer/index.js:367-368, and sibling child-node creation paths pass disableUrlAccess and disableFileAccess into MimeNode.lib/mime-node/index.js:51-52 stores those flags.lib/mime-node/index.js:984-995 rejects file paths with EFILEACCESS when disableFileAccess is set.lib/mime-node/index.js:998-1009 rejects URLs with EURLACCESS when disableUrlAccess is set.test/mail-composer/mail-composer-test.js:1028-1044 includes a normal MIME-streaming test that expects file access to be blocked when disableFileAccess: true.Additional same-root-cause variant:
lib/mailer/index.js:406-434 implements _convertDataImages() for attachDataUrls.lib/mailer/index.js:407-410 calls mail.resolveContent(mail.data, 'html', ...) when attachDataUrls is enabled and mail.data.html is present.mail.resolveContent() delegates to shared.resolveContent() at lib/mailer/mail-message.js:42-44, an object-form html: { path: ... } or html: { href: ... } can be resolved before the later MIME streaming enforcement sees the content.attachDataUrls to be enabled, so the main reportable default/common path is jsonTransport; both should be fixed by enforcing access flags inside the pre-resolution helper or passing policy into it.Default/common exposure evidence:
jsonTransport is a shipped runtime transport selected by public createTransport options.test/json-transport/json-transport-test.js:9-83 demonstrates that jsonTransport intentionally resolves file-backed html and attachments into JSON output.disableFileAccess and disableUrlAccess are documented by code and tests as security controls and are copied from transport options into message data for all transports.False-positive screening and negative controls:
disableFileAccess: true and disableUrlAccess: true transport options for both jsonTransport and normal streamTransport controls.jsonTransport read the temporary local fixture file and embedded the content in JSON despite disableFileAccess: true.streamTransport with the same attachment and disableFileAccess: true rejected with EFILEACCESS.jsonTransport fetched a local HTTP listener despite disableUrlAccess: true.streamTransport with the same URL and disableUrlAccess: true rejected with EURLACCESS.127.0.0.1 and did not contact external infrastructure.Affected version evidence and uncertainty:
nodemailer 8.0.8 at commit 15138a84c543c20aa399218534cdbbfa2ea1ce55.jsonTransport has existed since commit d78b63b (2017-02-09, "Added test for json transport"), and disableFileAccess appears in historical setup commit 6218b8d (2017-01-31), but older versions were not dynamically tested during this audit.Severity rationale:
path or href triggers the bypass when jsonTransport is used.Final self-review:
127.0.0.1 HTTP listener.streamTransport rejects the same inputs with EFILEACCESS and EURLACCESS.Medium Basis: The source's own band: MODERATE
0, fixed 8.0.9 (semver)8.0.9
8.0.9npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0