Critical Code Execution Vulnerability in jQuery UI Datepicker
Summary
CVE-2021-41183: jQuery-UI is the official jQuery user interface library. Affects jqueryui across 3 version ranges.
< 1.12.1+dfsg-8+deb11u1
< 6d072c596a81d99a77fc36c14caf3eb3a803689e
>= 497914920385b7016ac9c9367e0198530787adf2, < c991d5749144c851b71aa7be721715d7e346526f
Fixed in 1.12.1+dfsg-8+deb11u1. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
jQuery UI is a popular user interface library built on top of jQuery, providing a set of interactions, effects, widgets, and themes. The Datepicker widget allows users to select dates from a calendar interface. However, prior to version 1.13.0, the Datepicker widget was vulnerable to accepting untrusted input for various *Text options, which could lead to the execution of untrusted code, posing a significant security risk.
Vulnerability Detail
The vulnerability, identified as CVE-2021-41183, arises from the Datepicker widget's handling of input values for its *Text options. If these values are sourced from untrusted inputs, it may allow an attacker to execute arbitrary code. This can lead to unauthorized actions being performed on behalf of the user, data leakage, or even complete system compromise. The issue was addressed in jQuery UI version 1.13.0, where the library was updated to treat these values as plain text rather than HTML.
How To Fix
Minimum fixed version
1.12.1+dfsg-8+deb11u1
This is the first release that contains the fix.
sudo apt-get install --only-upgrade jqueryui
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid accepting values for the *Text options of the Datepicker widget from untrusted sources. This can be implemented by validating and sanitizing any user input before it is passed to the Datepicker options. For example, you can use the following code snippet to ensure that only safe values are accepted:
function safeInput(input) {
// Implement your validation logic here
return input.replace(/<[^>]*>/g, ''); // Simple HTML tag removal
}
$('#datepicker').datepicker({
onSelect: function(dateText) {
var safeDate = safeInput(dateText);
// Use safeDate for further processing
}
});
Conclusion
CVE-2021-41183 is a significant vulnerability in jQuery UI's Datepicker widget that can lead to code execution through untrusted input. It is crucial to update to version 1.13.0 or later to mitigate this risk. Implementing input validation can serve as a temporary measure while updates are being planned.
See every vulnerability recorded for jqueryui →
FAQ
CVE-2021-41183 is a vulnerability in jQuery UI's Datepicker widget that allows for the execution of untrusted code when accepting input from untrusted sources.
You can use Vulert, which monitors open-source vulnerabilities in your software by analyzing the manifest file like package-lock.json. Visit Vulert Scanner to check if your application is affected without needing to sign up.
All versions of jQuery UI prior to 1.13.0 are affected by this vulnerability.
If an immediate update is not possible, ensure that you do not accept input for the Datepicker's *Text options from untrusted sources and implement input validation.
The CVSS score of CVE-2021-41183 is 6.1, indicating a medium severity level.
Related vulnerabilities
Recent vulnerabilities recorded for jqueryui.