strnum is vulnerable to Regular Expression Denial of Service (ReDoS)
53
Medium Risk
The toNumber parser calls trimZeros unconditionally, which strips trailing zeros with a regular expression. On a decimal string that has a long run of zeros followed by a later non-zero digit, the regex backtracks once per zero. A small crafted input passed to the parser can therefore consume excessive CPU and stall the event loop, including when reached indirectly through consumers that parse untrusted values. The fix replaces the regex with a linear backward scan that produces identical output without the resource exhaustion.
You are affected if you are using a version that falls within the vulnerable range and your application passes untrusted strings to toNumber, directly or through a consumer such as an XML parser.
strnum is vulnerable to Regular Expression Denial of Service (ReDoS) in versions 0.0.1 - 2.4.1.
Upgrade the strnum library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant