Joomla: PHP Bug Introduces Multiple XSS Vulnerabilities (CVE-2024-21726)
Joomla's input sanitisation was bypassed due to inconsistent handling of invalid UTF-8 sequences by PHP's mbstring functions, leading to multiple XSS vulnerabilities. An attacker could trick an administrator into clicking a malicious link, resulting in remote code execution.
Published on sonarsource.com
Joomla is a free and open-source Content Management System (CMS) used for building websites and online applications. Roughly 2% of all websites use Joomla, which makes it one of the most popular CMSs with millions of deployments worldwide.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the root cause is an inconsistency between PHP's mb_strpos and mb_substr functions when handling invalid UTF-8 sequences, which Joomla's filter relied on for sanitisation.
What the attacker needed
Joomla 5.0.2/4.4.2 or below; Victim is an administrator; Victim clicks a malicious link
The fix
Joomla fixed the issue by replacing mbstring functions with PHP's regular string functions, and PHP 8.3 and 8.4 also fixed the underlying bug.
How it was found
- Craft a malicious link containing invalid UTF-8 sequences that bypass Joomla's input filter.
- Trick an administrator into clicking the link.
- The injected JavaScript executes in the administrator's browser.
- Use the JavaScript to customise a template and insert arbitrary PHP code.
- Gain remote code execution on the server.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Joomla is a system for building websites. It tries to clean up user input to prevent harmful code from running. However, a bug in how PHP (the programming language Joomla uses) handles certain text characters meant that the cleaning could be bypassed, allowing an attacker to insert malicious scripts. If an administrator clicked a specially crafted link, the attacker could take control of the website.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.