CVE-2021-3765: Inefficient Regular Expression Complexity in validator.js

validator Updated 02 Oct 2025

Summary

03/11/2021
Yes i
Moderate
5.3

CVE-2021-3765: Inefficient Regular Expression Complexity in validator.js. Affects validator versions < 13.7.0. Fixed in 13.7.0. 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The validator package is an npm package used for data validation in JavaScript applications. It provides various functions for validating strings, numbers, emails, URLs, and more. The package is widely used in web development projects to ensure data integrity and security. However, prior to version 13.7.0, validator.js is vulnerable to an inefficient regular expression complexity issue.

Vulnerability Detail

The vulnerability in validator.js arises from inefficient regular expressions used in the validator.rtrim function. This can lead to excessive backtracking and cause the function to consume a significant amount of CPU resources, potentially resulting in denial-of-service attacks. An attacker could exploit this vulnerability by providing specially crafted input that triggers the inefficient regular expression, causing the application to become unresponsive or crash. The impact of this vulnerability is considered moderate.

How To Fix

Latest published version: 13.15.35 as of 23 Oct 2026

npm install validator@13.15.35

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

13.7.0

This is the first release that contains the fix.

npm install validator@13.7.0

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 validator package to the fixed version to mitigate the risk.

Conclusion

In conclusion, the validator.js package prior to version 13.7.0 is vulnerable to an inefficient regular expression complexity issue. This can be exploited by attackers to cause denial-of-service attacks. To mitigate this risk, developers should update the package to version 13.7.0 or later. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for validator →

Share this vulnerability

FAQ

Validator.js is an npm package used for data validation in JavaScript applications. It provides functions for validating strings, numbers, emails, URLs, and more.

The vulnerability can lead to denial-of-service attacks by causing excessive CPU resource consumption. An attacker can exploit this to make the application unresponsive or crash.

Update the validator package to version 13.7.0 or later using the command npm install validator@latest.

No, there is no known workaround. Updating the package to the fixed version is the recommended solution.

There may be other vulnerabilities in validator.js that have not been disclosed or discovered yet. It is important to regularly update the package to ensure the latest security fixes are applied.

Related vulnerabilities

Recent vulnerabilities recorded for validator.

How To Fix

Latest published version: 13.15.35 as of 23 Oct 2026

npm install validator@13.15.35

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

13.7.0

This is the first release that contains the fix.

npm install validator@13.7.0

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