CVE-2021-33623: Uncontrolled Resource Consumption in trim-newlines

trim-newlines Updated 02 Oct 2025

Summary

07/06/2021
Yes i
High
7.5

CVE-2021-33623: Uncontrolled Resource Consumption in trim-newlines. Affects trim-newlines across 2 version ranges.

< 3.0.1 >= 4.0.0, < 4.0.1

Fixed in 3.0.1 or 4.0.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-33623 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The trim-newlines package is a Node.js module used for drawing charts using gnuplot and ps2pdf. It provides an easy-to-use interface for creating charts. However, versions before 3.0.1 and 4.x before 4.0.1 of trim-newlines are vulnerable to a regular expression denial-of-service (ReDoS) issue in the .end() method.

Vulnerability Detail

The vulnerability in trim-newlines arises from a regular expression denial-of-service (ReDoS) issue in the .end() method. An attacker can exploit this vulnerability by providing specially crafted input that triggers excessive backtracking in the regular expression used by the .end() method. This can lead to uncontrolled resource consumption, potentially causing a denial-of-service (DoS) condition. The severity of this vulnerability is rated as HIGH with a CVSS score of 7.5.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 3.0.1 3.0.1
    npm install trim-newlines@3.0.1
  • >= 4.0.0, < 4.0.1 4.0.1
    npm install trim-newlines@4.0.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

There is no known workaround for this vulnerability. It is recommended to update the trim-newlines package to the fixed versions as mentioned in the 'how_to_fix' section.

Conclusion

The trim-newlines package before 3.0.1 and 4.x before 4.0.1 for Node.js is vulnerable to a regular expression denial-of-service (ReDoS) issue. This can lead to uncontrolled resource consumption and potentially cause a denial-of-service (DoS) condition. It is crucial to update the trim-newlines package to the fixed versions mentioned in the 'how_to_fix' section to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for trim-newlines →

Share this vulnerability

FAQ

trim-newlines is a Node.js module used for drawing charts using gnuplot and ps2pdf.

This vulnerability can lead to uncontrolled resource consumption and potentially cause a denial-of-service (DoS) condition.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup. Vulert monitors and alerts in real-time for open-source vulnerabilities in software using just the package-lock.json file.

The severity of this vulnerability is rated as HIGH with a CVSS score of 7.5.

There is no known workaround for this vulnerability. It is recommended to update the trim-newlines package to the fixed versions.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 3.0.1 3.0.1
    npm install trim-newlines@3.0.1
  • >= 4.0.0, < 4.0.1 4.0.1
    npm install trim-newlines@4.0.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback