Skip to content
XSS Write-up Advanced

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.

Stefan Schiller Follow

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.

Stefan Schiller (@scryh_), on sonarsource.com

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

  1. Craft a malicious link containing invalid UTF-8 sequences that bypass Joomla's input filter.
  2. Trick an administrator into clicking the link.
  3. The injected JavaScript executes in the administrator's browser.
  4. Use the JavaScript to customise a template and insert arbitrary PHP code.
  5. 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.

More by Stefan Schiller

View all

10 more disclosed reports, best first.

More from Joomla!

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.