MooTools Regular Expression Denial of Service in mootools

mootools Updated 02 Oct 2025

Summary

03/01/2023
No i
High
7.5

CVE-2021-32821: MooTools Regular Expression Denial of Service. Affects mootools versions < 1.5.2. No fix is published. How to fix ↓

Also tracked for

The same CVE-2021-32821 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

MooTools is a collection of JavaScript utilities for JavaScript developers. It provides various functionalities and tools to simplify JavaScript development. One of the features included in MooTools is a CSS selector parser. This parser is used to parse and process CSS selectors in JavaScript applications. However, all known versions of MooTools are vulnerable to a Regular Expression Denial of Service (ReDoS) attack. This vulnerability can be exploited when an attacker is able to inject a malicious string into a CSS selector at runtime. This type of injection is common with libraries like jQuery that use CSS selectors. Unfortunately, there are no available patches to address this vulnerability at the moment.

Vulnerability Detail

The vulnerability in MooTools arises from a weakness in the CSS selector parser. The parser is susceptible to Regular Expression Denial of Service (ReDoS) attacks, which can lead to denial of service or performance degradation. An attacker can exploit this vulnerability by injecting a specially crafted string into a CSS selector, causing the parser to enter into an inefficient matching state. This can result in excessive CPU usage and potentially render the application unresponsive. The impact of this vulnerability can be severe, especially in scenarios where user input is used directly in CSS selectors.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As there are no available patches for this vulnerability, a possible workaround is to implement input validation and sanitization measures. By carefully validating and sanitizing user input before using it in CSS selectors, the risk of injection attacks can be mitigated. Here is an example of how input validation can be performed in JavaScript:

function sanitizeInput(input) {
  // Perform input validation and sanitization
  // ... 
  return sanitizedInput;
}

var userInput = getUserInput();
var sanitizedInput = sanitizeInput(userInput);

// Use the sanitized input in CSS selectors
var selector = '.class-' + sanitizedInput;
// ... 

Conclusion

The MooTools library, used by JavaScript developers, is vulnerable to a Regular Expression Denial of Service (ReDoS) attack. This vulnerability can be exploited by injecting a malicious string into a CSS selector, potentially leading to denial of service or performance degradation. While no patches are currently available, it is crucial to stay informed about updates and implement input validation and sanitization measures to mitigate the risk. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for mootools →

Share this vulnerability

FAQ

MooTools is a collection of JavaScript utilities for JavaScript developers. It provides various functionalities and tools to simplify JavaScript development.

A CSS selector parser is a tool or library that is used to parse and process CSS selectors in JavaScript applications. It allows developers to manipulate and interact with CSS selectors programmatically.

Regular Expression Denial of Service (ReDoS) is a type of vulnerability that can be exploited by malicious actors to cause denial of service or performance degradation. It occurs when a regular expression pattern takes a long time to evaluate certain inputs, leading to excessive CPU usage and potential application unresponsiveness.

An attacker can exploit this vulnerability by injecting a specially crafted string into a CSS selector at runtime. This can be done through user input or by manipulating the application's code. When the vulnerable CSS selector parser encounters the malicious string, it enters into an inefficient matching state, causing excessive CPU usage and potentially rendering the application unresponsive.

No, there are currently no available patches to address this vulnerability in MooTools. It is recommended to stay updated with the official MooTools repository or security advisories to be notified when a fix becomes available.

Related vulnerabilities

Recent vulnerabilities recorded for mootools.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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