CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-C7W3-X93F-QMM8

GHSA-C7W3-X93F-QMM8: SMTP Command Injection in Nodemailer via CRLF Sequences

Amit Schendel
Amit Schendel
Senior Security Researcher

Mar 27, 2026·6 min read·33 visits

Executive Summary (TL;DR)

A critical vulnerability in Nodemailer allows for SMTP command injection. Attackers controlling the `envelope.size` parameter can append CRLF characters to inject unauthorized SMTP commands, leading to unauthorized email routing and potential spam distribution.

Nodemailer, a widely utilized Node.js package for email transmission, contains a critical input validation vulnerability. The software fails to sanitize the `envelope.size` parameter, permitting attackers to inject arbitrary SMTP commands via CRLF sequences. This flaw facilitates unauthorized email distribution, bypassing of application-level recipient controls, and internal SMTP reconnaissance.

Vulnerability Overview

Nodemailer operates as a fundamental routing library for Node.js applications requiring electronic mail transmission capabilities. The software interfaces directly with upstream SMTP servers to negotiate message delivery, handling protocol-level commands on behalf of the application. GHSA-C7W3-X93F-QMM8 identifies a critical input validation flaw within the core SMTP connection handler.

The vulnerability allows threat actors to perform SMTP command injection via improper neutralization of CRLF sequences. This class of flaw, categorized under CWE-93, occurs when an application accepts untrusted input containing carriage return and line feed characters without appropriate sanitization. Because SMTP relies on these specific control characters to delineate commands, unsanitized input directly compromises the integrity of the protocol stream.

Applications become vulnerable when they expose the Nodemailer envelope configuration to external input. Threat actors exploit this pathway to append unauthorized commands to the active SMTP session. The resulting exploitation enables actions fundamentally outside the intended design of the vulnerable application, including sending unauthenticated spam or conducting localized reconnaissance.

Root Cause Analysis

The vulnerability originates in the lib/smtp-connection/index.js module during the construction of the MAIL FROM command sequence. When an upstream SMTP server advertises support for the SIZE extension (defined in RFC 1870), Nodemailer automatically appends the declared message size to the sender address declaration. The software extracts this size value directly from the user-provided envelope.size property.

The core failure lies in the implementation utilizing direct string concatenation without prior type validation or sanitization. The vulnerable codebase executes args.push('SIZE=' + this._envelope.size). Because the size variable accepts arbitrary strings, it can contain the carriage return and line feed characters (\r\n) required to terminate an SMTP command.

When Nodemailer transmits the concatenated string, the receiving SMTP server processes the injected CRLF sequence as the definitive end of the MAIL FROM transmission. The server immediately interprets any subsequent characters in the string as an entirely new, distinct SMTP command. This structural failure breaks the assumed boundary between application data and protocol control instructions.

Code Analysis

The patch resolves the vulnerability by strictly enforcing data types on the envelope.size parameter. The developers replaced the direct string concatenation with a robust type coercion mechanism. The patched implementation passes the input through the standard JavaScript Number() function before evaluation.

// Vulnerable Implementation
if (this._envelope.size && this._supportedExtensions.includes('SIZE')) {
    args.push('SIZE=' + this._envelope.size);
}

The original code merely checked for the truthiness of this._envelope.size. Any non-empty string, including an injection payload, satisfied this condition and entered the command stream. The updated logic forces the input into a numeric context.

// Patched Implementation
if (this._envelope.size && this._supportedExtensions.includes('SIZE')) {
    const sizeValue = Number(this._envelope.size) || 0;
    if (sizeValue > 0) {
        args.push('SIZE=' + sizeValue);
    }
}

If an attacker submits a payload containing command injection sequences such as 100\r\nRCPT TO:<evil@example.com>, the Number() coercion evaluates the entire string. Because the string contains non-numeric characters, the evaluation strictly returns NaN (Not-a-Number). The subsequent logical OR operation (|| 0) defaults the result to zero. Finally, the conditional check if (sizeValue > 0) fails, preventing the system from appending the malformed SIZE extension entirely.

Exploitation Methodology

Attackers exploit this vulnerability by manipulating application inputs that map directly to the Nodemailer envelope configuration. The primary prerequisite involves locating an application endpoint that accepts arbitrary values for the size parameter and passes them unvalidated to the send() function. This typically manifests in custom mailer integrations or APIs designed to handle complex email routing.

The attacker constructs a targeted payload consisting of a valid integer, a CRLF sequence, and a secondary SMTP command. A standard payload takes the form of 100\r\nRCPT TO:<injected@evil.com>. When the application processes this input, the Nodemailer client transmits a fragmented command string to the upstream mail server.

The receiving SMTP server processes the first segment (MAIL FROM:<legit@app.com> SIZE=100) as a complete, syntactically valid command. It then interprets the subsequent line (RCPT TO:<hacker@evil.com>) as a distinct command originating from the authenticated client. This execution flow entirely bypasses any recipient limitations enforced by the Node.js application layer.

Impact Assessment

Successful exploitation grants an attacker arbitrary command execution within the context of the established SMTP session. The most direct consequence involves unauthorized email distribution. Threat actors utilize the application's authenticated, trusted SMTP session to originate spam or targeted phishing campaigns, effectively laundering their attacks through the victim's infrastructure.

By injecting supplementary RCPT TO commands, attackers bypass application-level recipient restrictions. Applications designed to send password resets or notifications strictly to registered users can be coerced into delivering those sensitive communications to external, attacker-controlled addresses. This facilitates data exfiltration and account takeover scenarios depending on the email content.

Furthermore, attackers utilize this vector to conduct internal reconnaissance against the SMTP infrastructure. Threat actors can inject commands such as VRFY or EXPN to enumerate internal mailing lists and user accounts. If the SMTP server possesses access to isolated network segments, the vulnerability serves as a pivot point for broader infrastructure mapping.

Remediation and Mitigation

System administrators and developers must upgrade the nodemailer package to a release incorporating commit 2d7b9710e63555a1eb13d721296c51186d4b5651. This update ensures the library natively coerces the size parameter into a safe numeric format, neutralizing the injection vector at the library level. Organizations should verify their dependency trees to ensure secondary packages utilizing Nodemailer are similarly updated.

As a crucial defense-in-depth measure, applications should implement strict input validation on all user-supplied data destined for the mail envelope. Developers must ensure that all SMTP parameters, including from, to, and size, strictly reject inputs containing carriage return (\r) or line feed (\n) characters. Relying solely on downstream libraries for protocol sanitization violates core secure design principles.

Security operations teams should monitor upstream SMTP server logs for anomalous command sequences. Specifically, defenders should baseline typical application behavior and alert on sessions generating multiple, unexpected MAIL FROM or RCPT TO commands in rapid succession. High volumes of rejected commands within a single authenticated session often indicate active exploitation attempts against this protocol layer.

Fix Analysis (1)

Technical Appendix

CVSS Score
9.8/ 10

Affected Systems

Nodemailer (npm package: nodemailer)

Affected Versions Detail

Product
Affected Versions
Fixed Version
Nodemailer
Nodemailer
< patched release (commit 2d7b9710e6)Commit 2d7b9710e63555a1eb13d721296c51186d4b5651
AttributeDetail
CWE IDCWE-93, CWE-150, CWE-20
Attack VectorNetwork
ImpactSMTP Command Injection / Unauthorized Email Routing
Vulnerable Componentlib/smtp-connection/index.js (envelope.size handling)
Exploit StatusProof-of-Concept
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1059Command and Scripting Interpreter
Execution
T1566Phishing
Initial Access
T1589Gather Victim Identity Information
Reconnaissance
CWE-93
Improper Neutralization of CRLF Sequences

Improper Neutralization of CRLF Sequences ('CRLF Injection')

References & Sources

  • [1]GitHub Advisory: GHSA-C7W3-X93F-QMM8
  • [2]Fix Commit: 2d7b9710e63555a1eb13d721296c51186d4b5651
  • [3]Nodemailer Repository

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 7 hours ago•CVE-2026-48861
2.1

CVE-2026-48861: HTTP Request Splitting and Smuggling via Method Parameter CRLF Injection in Elixir Mint

CVE-2026-48861 is a client-side HTTP request-line CRLF (Carriage Return Line Feed) injection vulnerability in the popular Elixir HTTP client library, Mint. The vulnerability permits HTTP Request Splitting and HTTP Request Smuggling when an application forwards untrusted, attacker-controlled inputs to Mint's HTTP client requests as either the HTTP request method or target. By embedding CRLF characters within these parameters, an attacker can terminate the request line prematurely, inject malicious headers, or pipeline entirely independent requests. These smuggled requests are then processed by upstream or downstream proxy servers as separate HTTP queries on the same TCP connection. While Mint version 1.7.0 introduced target validation to secure the request target, the HTTP request method parameter remained completely unvalidated. This flaw allows attackers to bypass routing filters, access restricted internal APIs, or poison HTTP caches under default configurations.

Amit Schendel
Amit Schendel
4 views•7 min read
•about 7 hours ago•CVE-2026-49753
6.3

CVE-2026-49753: HTTP Request/Response Smuggling via Inconsistent Content-Length Parsing in Elixir Mint Client

An Inconsistent Interpretation of HTTP Requests (HTTP Request/Response Smuggling) vulnerability in the Elixir Mint HTTP client allows attacker-controlled HTTP/1 servers to desynchronize response framing on shared connections due to over-lenient parsing of sign-prefixed Content-Length headers.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 8 hours ago•CVE-2026-49754
8.2

CVE-2026-49754: Denial of Service via Unbounded HTTP/2 CONTINUATION Frame Accumulation in Elixir Mint

An allocation of resources without limits or throttling vulnerability in Elixir Mint allows an attacker-controlled HTTP/2 server to exhaust memory in a Mint client. The vulnerability is exploited by sending a HEADERS frame without the END_HEADERS flag followed by an infinite stream of CONTINUATION frames. Because the client lacks limits on the incoming header-block accumulator, the client continuously consumes memory until an out-of-memory crash occurs.

Amit Schendel
Amit Schendel
7 views•6 min read
•about 8 hours ago•CVE-2026-48596
2.1

CVE-2026-48596: Improper Neutralization of CRLF Sequences in Elixir Tesla Multipart HTTP Client

CVE-2026-48596 is an Improper Neutralization of CRLF Sequences in HTTP Headers (HTTP Request/Response Splitting, CWE-113) in the Elixir Tesla HTTP client. The flaw resides in how multipart content-type parameters are joined and serialized, enabling attackers to inject arbitrary headers or split HTTP requests when applications pass untrusted inputs to the parameters of multipart uploads.

Alon Barad
Alon Barad
5 views•6 min read
•about 9 hours ago•CVE-2026-48594
8.2

CVE-2026-48594: Decompression Bomb Denial of Service in Elixir Tesla HTTP Client

An improper handling of highly compressed data (decompression bomb) vulnerability exists in the Elixir Tesla HTTP client when utilizing response decompression middlewares. By serving highly compressed responses or stacked content-encoding headers, a malicious server can cause arbitrary heap exhaustion, leading to a denial of service (DoS) crash in the BEAM virtual machine.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 9 hours ago•CVE-2026-48595
8.2

CVE-2026-48595: Cross-Origin Credential Leakage in Elixir Tesla Client via Case-Sensitive Redirect Filter Bypass

A high-severity security vulnerability in Elixir's Tesla HTTP client library (CVE-2026-48595) allows unauthenticated remote attackers to harvest sensitive credentials, including Authorization headers and cookies. The flaw resides in the 'Tesla.Middleware.FollowRedirects' component, which performs case-sensitive lookups when stripping credentials during cross-origin redirects. Because HTTP headers are case-insensitive by RFC specifications, standard canonical casing (e.g., 'Authorization') bypasses the lowercase-only blocklist, leaking tokens to untrusted external redirect destinations.

Alon Barad
Alon Barad
6 views•5 min read