Regular Expression Denial of Service in millisecond

millisecond Updated 02 Oct 2025

Summary

22/09/2021
MODERATE
Yes i
Moderate
Not published

GHSA-m489-xr35-fjxr: Regular Expression Denial of Service in millisecond. Affects millisecond versions < 0.1.2. Fixed in 0.1.2. 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 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 millisecond package is an npm package that provides a utility for parsing and converting time durations in various formats. It allows developers to easily convert time durations from strings to milliseconds. The package is commonly used in JavaScript applications to handle time-related operations.

Vulnerability Detail

Versions of millisecond prior to 0.1.2 are affected by a regular expression denial of service (ReDoS) vulnerability. This vulnerability occurs when extremely long version strings are parsed, leading to excessive backtracking in the regular expression engine. An attacker can exploit this vulnerability by providing a maliciously crafted version string, causing the application to consume excessive CPU resources and potentially leading to a denial of service (DoS) condition. The impact of this vulnerability can range from performance degradation to complete unavailability of the affected application.

How To Fix

Minimum fixed version

0.1.2

This is the first release that contains the fix.

npm install millisecond@0.1.2

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

Workaround

If updating the millisecond package is not immediately feasible, a temporary workaround can be implemented by validating and limiting the length of the version string input before passing it to the millisecond package. This can be done by checking the length of the version string and rejecting inputs that exceed a reasonable limit. Here is an example of how this can be done in JavaScript:

const ms = require('millisecond');

function validateVersionString(version) {
  const MAX_LENGTH = 100;
  if (version.length > MAX_LENGTH) {
    throw new Error('Invalid version string');
  }
}

try {
  validateVersionString('1.2.3.4.5.6.7.8.9.10');
  ms('1.2.3.4.5.6.7.8.9.10');
} catch (error) {
  console.error('Error:', error.message);
}

Conclusion

In conclusion, the millisecond package prior to version 0.1.2 is vulnerable to a regular expression denial of service (ReDoS) vulnerability. This can be exploited by providing a maliciously crafted version string, leading to excessive CPU usage and potential denial of service. It is recommended to update the package to version 0.1.2 or later to mitigate this vulnerability. If immediate update is not possible, implementing a length validation workaround can help reduce the risk of exploitation. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for millisecond →

Share this vulnerability

FAQ

The impact of this vulnerability can range from performance degradation to complete unavailability of the affected application. An attacker can exploit this vulnerability to cause a denial of service (DoS) condition by providing a maliciously crafted version string.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. The playground allows you to analyze your package-lock.json file and provides real-time monitoring and alerts for open-source vulnerabilities.

Yes, a temporary workaround can be implemented by validating and limiting the length of the version string input before passing it to the millisecond package. This can help mitigate the risk of exploitation while an update to the latest version is being performed.

To fix this vulnerability, you need to update the millisecond package to version 0.1.2 or later. You can do this by running the command npm install millisecond@0.1.2 in your project directory.

How To Fix

Minimum fixed version

0.1.2

This is the first release that contains the fix.

npm install millisecond@0.1.2

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