GHSA-wqvq-jvpq-h66f: Nodemailer Nodemailer JsonTransport Bypasses DisableFileAccess And Vulnerability
MODERATEGHSA-wqvq-jvpq-h66f is a MODERATE (CVSS 5.4) nodemailer jsontransport bypasses disablefileaccess and vulnerability (CWE-862: Missing Authorization) affecting Nodemailer libraries in the npm ecosystem. The issue involves nodemailer jsontransport bypasses disablefileaccess and disableurlaccess during message normalization. Remediation is available by upgrading affected packages to version 8.0.9.
GHSA-wqvq-jvpq-h66f at a Glance
Security Impact
CVSS: 5.4
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:L/I:L/A:N).
How to Fix GHSA-wqvq-jvpq-h66f
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@8.0.9
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 GHSA-wqvq-jvpq-h66f, 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 8.0.9), 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 & Technical Analysis
This vulnerability is classified under CWE-862: Missing Authorization, where the product does not perform an authorization check when an actor attempts to access a resource or perform an action. In Nodemailer, 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
GHSA-wqvq-jvpq-h66f Affected Nodemailer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
nodemailer
|
npm |
< 8.0.9
|
8.0.9
|
References
Frequently Asked Questions
What is GHSA-wqvq-jvpq-h66f?
Which Nodemailer versions are affected?
What version fixes GHSA-wqvq-jvpq-h66f?
Is nodemailer affected?
What is the CVSS score of GHSA-wqvq-jvpq-h66f?
What CWE is associated with GHSA-wqvq-jvpq-h66f?
How can I check npm dependencies for GHSA-wqvq-jvpq-h66f?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wqvq-jvpq-h66f",
"modified" : "2026-06-15T17:35:10Z",
"published" : "2026-06-15T17:35:10Z",
"aliases" : [ ],
"summary" : "Nodemailer jsonTransport bypasses disableFileAccess and disableUrlAccess during message normalization",
"details" : "### Summary\n\nNodemailer'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`.\n\nAs 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`.\n\nThe 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.\n\n### Details\nSource-to-sink evidence:\n\n- `lib/nodemailer.js:42-45` selects `JSONTransport` when `createTransport({ jsonTransport: true, ... })` is used.\n- `lib/mailer/mail-message.js:34-39` copies transport-level `disableFileAccess` and `disableUrlAccess` options into `mail.data`.\n- `lib/json-transport/index.js:52-76` serializes mail by calling `mail.normalize((err, data) => ...)`.\n- `lib/mailer/mail-message.js:46-135` implements `resolveAll()` and calls `shared.resolveContent(...args, ...)` for `html`, `text`, `watchHtml`, `amp`, `icalEvent`, alternatives, and attachments.\n- `lib/shared/index.js:506-562` implements `resolveContent()`.\n- `lib/shared/index.js:540-541` fetches HTTP(S) content with `nmfetch(content.path || content.href)`.\n- `lib/shared/index.js:549-550` reads local files with `fs.createReadStream(content.path)`.\n- `shared.resolveContent()` does not check `disableFileAccess` or `disableUrlAccess` and does not receive those flags.\n\nControl path showing intended enforcement:\n\n- `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`.\n- `lib/mime-node/index.js:51-52` stores those flags.\n- `lib/mime-node/index.js:984-995` rejects file paths with `EFILEACCESS` when `disableFileAccess` is set.\n- `lib/mime-node/index.js:998-1009` rejects URLs with `EURLACCESS` when `disableUrlAccess` is set.\n- `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`.\n\nAdditional same-root-cause variant:\n\n- `lib/mailer/index.js:406-434` implements `_convertDataImages()` for `attachDataUrls`.\n- `lib/mailer/index.js:407-410` calls `mail.resolveContent(mail.data, 'html', ...)` when `attachDataUrls` is enabled and `mail.data.html` is present.\n- Because `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.\n- This variant requires `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.\n\nDefault/common exposure evidence:\n\n- `jsonTransport` is a shipped runtime transport selected by public `createTransport` options.\n- `test/json-transport/json-transport-test.js:9-83` demonstrates that `jsonTransport` intentionally resolves file-backed `html` and attachments into JSON output.\n- `disableFileAccess` and `disableUrlAccess` are documented by code and tests as security controls and are copied from transport options into message data for all transports.\n- The bypass does not require test-only code, external infrastructure, unsupported configuration, or maintainer-only APIs.\n\nFalse-positive screening and negative controls:\n\n- The local PoC used the same `disableFileAccess: true` and `disableUrlAccess: true` transport options for both `jsonTransport` and normal `streamTransport` controls.\n- `jsonTransport` read the temporary local fixture file and embedded the content in JSON despite `disableFileAccess: true`.\n- `streamTransport` with the same attachment and `disableFileAccess: true` rejected with `EFILEACCESS`.\n- `jsonTransport` fetched a local HTTP listener despite `disableUrlAccess: true`.\n- `streamTransport` with the same URL and `disableUrlAccess: true` rejected with `EURLACCESS`.\n- The local URL proof used only `127.0.0.1` and did not contact external infrastructure.\n\nAffected version evidence and uncertainty:\n\n- Confirmed vulnerable: `nodemailer` 8.0.8 at commit `15138a84c543c20aa399218534cdbbfa2ea1ce55`.\n- Git history shows `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.\n- Affected range is therefore recorded as unknown beyond the confirmed current version.\n- No patched version was identified in this checkout.\n\nSeverity rationale:\n\n- AV: The vulnerable library path is typically reached through an application-level message submission or rendering/queueing feature.\n- AC: A single message field using `path` or `href` triggers the bypass when `jsonTransport` is used.\n- PR: Conservative assumption that the attacker is a lower-privileged user of an application that accepts partially user-controlled message objects. Some deployments may expose this unauthenticated, but that was not assumed.\n- UI: No user interaction is required after the application accepts the message object.\n- S: The impact remains in the embedding application/library security scope.\n- C: Local file contents can be copied into the generated JSON output when the application later stores, logs, returns, or forwards that JSON.\n- I: The attacker can induce outbound HTTP requests to attacker-chosen or internal URLs from the application host when URL access was intended to be disabled.\n- A: No availability impact was demonstrated; the PoC used bounded local files and a localhost listener only.\n\nFinal self-review:\n\n- Reproduction evidence was generated locally from this checkout using only a temporary file under the OS temp directory and a local `127.0.0.1` HTTP listener.\n- The PoC included positive proof for file read and URL fetch, plus negative controls showing normal `streamTransport` rejects the same inputs with `EFILEACCESS` and `EURLACCESS`.\n- The proof is non-destructive, performs no external network traffic, and deletes its temporary fixture.\n- Reachability, package exposure, policy-enforcement bypass, same-root-cause variant, and false-positive controls were checked as described above.\n- The affected range is not overclaimed; only the current tested version is confirmed vulnerable.\n\n### PoC\n\nFrom a clean checkout of `nodemailer` at commit `15138a84c543c20aa399218534cdbbfa2ea1ce55`, run:\n\n```bash\nnode <<'NODE'\n'use strict';\nconst fs = require('fs');\nconst os = require('os');\nconst path = require('path');\nconst http = require('http');\nconst nodemailer = require('./');\nconst marker = 'NM_JSON_BYPASS_' + Date.now();\nconst fixture = path.join(os.tmpdir(), 'nodemailer-json-bypass-' + process.pid + '.txt');\nfs.writeFileSync(fixture, marker);\nfunction sendMail(transport, data) {\n return new Promise((resolve, reject) => transport.sendMail(data, (err, info) => err ? reject(err) : resolve(info)));\n}\n(async () => {\n const jsonTransport = nodemailer.createTransport({ jsonTransport: true, disableFileAccess: true, disableUrlAccess: true });\n const jsonInfo = await sendMail(jsonTransport, {\n from: 'sender@example.test',\n to: 'recipient@example.test',\n subject: 'json file bypass',\n text: 'body',\n attachments: [{ filename: 'secret.txt', path: fixture }]\n });\n const jsonMessage = JSON.parse(jsonInfo.message);\n const decoded = Buffer.from(jsonMessage.attachments[0].content, 'base64').toString('utf8');\n console.log('JSON_FILE_BYPASS=' + (decoded === marker));\n console.log('JSON_FILE_CONTENT=' + decoded);\n\n const streamTransport = nodemailer.createTransport({ streamTransport: true, buffer: true, disableFileAccess: true });\n try {\n await sendMail(streamTransport, {\n from: 'sender@example.test',\n to: 'recipient@example.test',\n subject: 'stream control',\n text: 'body',\n attachments: [{ filename: 'secret.txt', path: fixture }]\n });\n console.log('STREAM_FILE_CONTROL=NO_ERROR');\n } catch (err) {\n console.log('STREAM_FILE_CONTROL=' + err.code);\n }\n\n const server = http.createServer((req, res) => {\n console.log('LOCAL_HTTP_REQUEST=' + req.method + ' ' + req.url);\n res.end('LOCAL_HTTP_MARKER');\n });\n await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));\n const url = 'http://127.0.0.1:' + server.address().port + '/private';\n const jsonUrlInfo = await sendMail(jsonTransport, {\n from: 'sender@example.test',\n to: 'recipient@example.test',\n subject: 'json url bypass',\n text: { href: url }\n });\n const jsonUrlMessage = JSON.parse(jsonUrlInfo.message);\n console.log('JSON_URL_BYPASS=' + (jsonUrlMessage.text === 'LOCAL_HTTP_MARKER'));\n const streamUrlTransport = nodemailer.createTransport({ streamTransport: true, buffer: true, disableUrlAccess: true });\n try {\n await sendMail(streamUrlTransport, {\n from: 'sender@example.test',\n to: 'recipient@example.test',\n subject: 'stream url control',\n text: { href: url }\n });\n console.log('STREAM_URL_CONTROL=NO_ERROR');\n } catch (err) {\n console.log('STREAM_URL_CONTROL=' + err.code);\n }\n server.close();\n fs.unlinkSync(fixture);\n})().catch(err => { try { fs.unlinkSync(fixture); } catch (E) {} console.error(err && err.stack || err); process.exit(1); });\nNODE\n```\n\nObserved output in this environment:\n\n```text\nJSON_FILE_BYPASS=true\nJSON_FILE_CONTENT=NM_JSON_BYPASS_1779802076150\nSTREAM_FILE_CONTROL=EFILEACCESS\nLOCAL_HTTP_REQUEST=GET /private\nJSON_URL_BYPASS=true\nSTREAM_URL_CONTROL=EURLACCESS\n```\n\nExpected vulnerable output: `JSON_FILE_BYPASS=true`, the printed temporary marker in `JSON_FILE_CONTENT`, a `LOCAL_HTTP_REQUEST=GET /private` line, and `JSON_URL_BYPASS=true`. Expected negative/control output: `STREAM_FILE_CONTROL=EFILEACCESS` and `STREAM_URL_CONTROL=EURLACCESS`, showing the same policy flags work in the normal streaming transport.\n\nCleanup: the PoC removes its temporary fixture file before exiting and closes the local HTTP server.\n\n### Impact\n\nIf an application uses `jsonTransport` to safely serialize or queue partially user-controlled Nodemailer message objects while relying on `disableFileAccess` / `disableUrlAccess`, an attacker can bypass those protections. The file-read variant can copy local file contents into the generated JSON message output. The URL-fetch variant can force outbound HTTP requests from the application host to local or internal services despite URL access being disabled. The impact depends on what message fields the embedding application exposes and where it stores or returns the generated JSON, but the local PoC confirms both protected sink operations are reached.\n\n### Suggested remediation\n\nEnforce `disableFileAccess` and `disableUrlAccess` inside `shared.resolveContent()` or pass an explicit policy object into every pre-resolution call and reject protected `path` / `href` values before opening files or fetching URLs. Apply the same fix to `jsonTransport` normalization and the `attachDataUrls` pre-plugin path. Add regression tests showing `jsonTransport` returns `EFILEACCESS` / `EURLACCESS` for file and URL content when those flags are set, and that `attachDataUrls` cannot resolve object-form `html.path` / `html.href` when the corresponding access flag is disabled.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "nodemailer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "8.0.9"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 8.0.8"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/nodemailer/nodemailer/security/advisories/GHSA-wqvq-jvpq-h66f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/nodemailer/nodemailer"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-862" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-15T17:35:10Z",
"nvd_published_at" : null
}
}