CVE-2024-24807: Sulu HTML Injection via Autocomplete Suggestion
Summary
CVE-2024-24807: Sulu HTML Injection via Autocomplete Suggestion. Affects sulu/sulu across 2 version ranges.
>= 2.0.0, < 2.4.16
>= 2.5.0, < 2.5.12
Fixed in 2.4.16 or 2.5.12, depending on the release line you run. 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
Sulu is an open-source content management platform built on Symfony. It provides a flexible and extensible framework for creating and managing websites and web applications. Sulu allows users to create tags, and only admin users have the ability to create tags. The vulnerability in Sulu allows for HTML injection when inputting HTML into the tag name, which is executed when the tag name is listed in the autocomplete form. This vulnerability affects only admin users.
Vulnerability Detail
The HTML injection vulnerability in Sulu allows an attacker to inject malicious HTML code into the tag name, which is executed when the tag name is listed in the autocomplete form. This can lead to various security issues, such as cross-site scripting (XSS) attacks, where an attacker can execute arbitrary JavaScript code in the context of the admin user's session. Since only admin users can create tags, this vulnerability is limited to admin users.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
>= 2.0.0, < 2.4.162.4.16composer require sulu/sulu:2.4.16 -
>= 2.5.0, < 2.5.122.5.12composer require sulu/sulu:2.5.12
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
If users are unable to immediately upgrade to the patched versions, they can create a custom mutation observer to monitor and sanitize the tag name input, preventing the execution of any injected HTML code. Here is an example of how to create a custom mutation observer in JavaScript:
// Create a mutation observer
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
// Check if the tag name input has changed
if (mutation.target.id === 'tag-name-input') {
// Sanitize the input value
const sanitizedValue = sanitizeHTML(mutation.target.value);
// Set the sanitized value back to the input
mutation.target.value = sanitizedValue;
}
});
});
// Start observing the tag name input
observer.observe(document.getElementById('tag-name-input'), { attributes: true, attributeFilter: ['value'] });
Conclusion
The HTML injection vulnerability in Sulu can be mitigated by upgrading to the patched versions or implementing the provided workaround. It is important for admin users of Sulu to take action to protect their systems from potential security risks. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for sulu/sulu →
FAQ
Only admin users of Sulu are affected by this vulnerability. Regular users do not have the ability to create tags.
The impact of this vulnerability is that an attacker can inject malicious HTML code into the tag name, which is executed when the tag name is listed in the autocomplete form. This can lead to cross-site scripting (XSS) attacks and other security issues.
You can use the Vulert Playground at Vulert Scanner to check if your Sulu installation is affected by this vulnerability. Simply enter your composer.lock file and the playground will analyze it for any open-source vulnerabilities, including this one.
Yes, if you are unable to immediately upgrade to the patched versions, you can create a custom mutation observer to monitor and sanitize the tag name input, preventing the execution of any injected HTML code. Please refer to the 'workaround' section for an example.
For more information about this vulnerability, you can open an issue in the sulu/sulu repository on GitHub or email security@sulu.io.
References
Related vulnerabilities
Recent vulnerabilities recorded for sulu/sulu.