CVE-2024-26151 Potentially untrusted input is rendered as HTML in final output
Attackers can inject malicious HTML into emails via untrusted input in mjml-python templates, potentially executing scripts in recipients' email clients.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2024-26151?
CVE-2024-26151 is a high-severity cross-site scripting vulnerability in FelixSchwarz mjml-python, published on 22 Feb 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Official description
The `mjml` PyPI package, found at the `FelixSchwarz/mjml-python` GitHub repo, is an unofficial Python port of MJML, a markup language created by Mailjet. All users of `FelixSchwarz/mjml-python` who insert untrusted data into mjml templates unless that data is checked in a very strict manner. User input like `<script>` would be rendered as `<script>` in the final HTML output. The attacker must be able to control some data which is later injected in an mjml template which is then send out as email to other users. The attacker could control contents of email messages sent through the platform. The problem has been fixed in version 0.11.0 of this library. Versions before 0.10.0 are not affected by this security issue. As a workaround, ensure that potentially untrusted user input does not contain any sequences which could be rendered as HTML.
Which versions are affected by CVE-2024-26151?
3 open source packages ship an affected version, including mjml. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
mjml PyPI | From 0.10.0 | 0.11.0 |
mjml PyPI | From 0.10.0 | 0.11.0 |
mjml PyPI | From 0.10.0 | 0.11.0 |
Products include Felixschwarz Mjml-Python.
How do I fix CVE-2024-26151?
Upgrade mjml to 0.11.0 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2024-26151 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-26151 exists.
Sources
Also known as GHSA-578p-fxmm-6229, PYSEC-2026-1631.