CVE-2021-23425: Uncontrolled Resource Consumption in trim-off-newlines

trim-off-newlines Updated 02 Oct 2025

Summary

02/09/2021
Yes i
Moderate
5.3

CVE-2021-23425: Uncontrolled Resource Consumption in trim-off-newlines. Affects trim-off-newlines versions < 1.0.3. Fixed in 1.0.3. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The trim-off-newlines package is an npm package that provides a function for removing trailing newline characters from a string. It is commonly used in JavaScript applications to sanitize user input or manipulate text data. The package is vulnerable to a Regular Expression Denial of Service (ReDoS) attack, which can lead to uncontrolled resource consumption. This vulnerability affects all versions of the trim-off-newlines package.

Vulnerability Detail

The vulnerability in trim-off-newlines arises from the way it processes strings using regular expressions. An attacker can craft a malicious input string that triggers a ReDoS attack, causing the package to enter into an infinite loop and consume excessive CPU resources. This can lead to a denial of service (DoS) condition, impacting the availability of the application or system using the vulnerable package. The severity of this vulnerability is rated as MODERATE with a CVSS score of 5.3.

How To Fix

Latest published version: 1.0.3 as of 23 Oct 2026

npm install trim-off-newlines@1.0.3

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is essential to update the trim-off-newlines package to the fixed version to mitigate the risk of a ReDoS attack.

Conclusion

The trim-off-newlines package is vulnerable to a ReDoS attack, which can lead to uncontrolled resource consumption and a denial of service condition. It is crucial to update the package to version 1.0.3 or later to mitigate this vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for trim-off-newlines →

Share this vulnerability

FAQ

The trim-off-newlines package is an npm package that provides a function for removing trailing newline characters from a string.

A ReDoS (Regular Expression Denial of Service) attack is a type of vulnerability where a maliciously crafted input string can cause a regular expression matching algorithm to exhibit exponential time complexity, leading to excessive CPU usage and potentially a denial of service condition.

The vulnerability in trim-off-newlines can lead to uncontrolled resource consumption, causing excessive CPU usage and potentially a denial of service condition. This can impact the availability of the application or system using the vulnerable package.

To fix the vulnerability, it is recommended to upgrade to version 1.0.3 or later of the trim-off-newlines package.

There is no known workaround for this vulnerability. It is essential to update the trim-off-newlines package to the fixed version.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 1.0.3 as of 23 Oct 2026

npm install trim-off-newlines@1.0.3

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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