CVE-2024-26151: Mjml Potentially Untrusted Input Is Rendered Vulnerability

HIGH
Advisory Identifier: GHSA-578p-fxmm-6229
CVSS 8.2
CWE-20 CWE-79
Published
Advisory Summary

CVE-2024-26151 is a HIGH (CVSS 8.2) potentially untrusted input is rendered vulnerability (CWE-20: Improper Input Validation) affecting Mjml libraries in the PyPI ecosystem. The issue involves potentially untrusted input is rendered as html in final output. Remediation is available by upgrading affected packages to version 0.11.0.

CVE-2024-26151 at a Glance

CVE Identifier CVE-2024-26151
GHSA Identifier GHSA-578p-fxmm-6229
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-20: Improper Input Validation
Affected Product Mjml
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:H/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2024-26151

To remediate this vulnerability, upgrade all affected Mjml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mjml fixed: 0.11.0
pip install mjml>=0.11.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show mjml

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-26151, inspect your installed packages using pip:

pip show mjml

Analyze the terminal output to locate any version of Mjml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.11.0), your application is affected.

Note: The pip show mjml command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Mjml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact All users of mjml-python who insert untrusted data into mjml templates unless that data is checked in a very strict manner. User input like `&lt;script&gt;` 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. ### Patches 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 which was added as part of commit 84c495da20a91640a1ca551ace17df7f3be644aa. ### Workarounds - Ensure that potentially untrusted user input does not contain any sequences which could be rendered as HTML. ### References - Initial issue report by @sh-at-cs in #52

CVE-2024-26151 Affected Mjml Versions

1 component(s)
Fixed Versions:
0.11.0
Product / Package Ecosystem Affected Versions Fixed Version
mjml
PyPI
≥ 0.10.0
< 0.11.0
All 1 versions
0.10.0
0.11.0

References

Frequently Asked Questions

What is CVE-2024-26151?
CVE-2024-26151 is a security vulnerability in Mjml involving Potentially untrusted input is rendered as HTML in final output under CWE-20: Improper Input Validation.
Which Mjml versions are affected?
Affected versions include releases prior to 0.11.0 across affected packages: mjml.
What version fixes CVE-2024-26151?
Upgrading to 0.11.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mjml affected?
Yes, mjml is affected in releases prior to 0.11.0. Upgrade your dependency to 0.11.0 or later.
What is the CVSS score of CVE-2024-26151?
CVE-2024-26151 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:H/A:L.
What CWE is associated with CVE-2024-26151?
CVE-2024-26151 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check PyPI dependencies for CVE-2024-26151?
Run the dependency tree command: 'pip show mjml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-578p-fxmm-6229",
  "modified" : "2024-02-22T21:40:59Z",
  "published" : "2024-02-22T21:40:59Z",
  "aliases" : [ "CVE-2024-26151" ],
  "summary" : "Potentially untrusted input is rendered as HTML in final output",
  "details" : "### Impact\n\nAll users of mjml-python who insert untrusted data into mjml templates unless that data is checked in a very strict manner. User input like `&lt;script&gt;` would be rendered as `<script>` in the final HTML output.\n\nThe 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.\n\n### Patches\n\nThe problem has been fixed in version 0.11.0 of this library. Versions before 0.10.0 are not affected by this security issue which was added as part of commit 84c495da20a91640a1ca551ace17df7f3be644aa.\n\n\n### Workarounds\n\n- Ensure that potentially untrusted user input does not contain any sequences which could be rendered as HTML. \n\n\n### References\n\n- Initial issue report by @sh-at-cs in #52\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "mjml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.10.0"
      }, {
        "fixed" : "0.11.0"
      } ]
    } ],
    "versions" : [ "0.10.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/FelixSchwarz/mjml-python/security/advisories/GHSA-578p-fxmm-6229"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-26151"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FelixSchwarz/mjml-python/issues/52"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FelixSchwarz/mjml-python/commit/84c495da20a91640a1ca551ace17df7f3be644aa"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FelixSchwarz/mjml-python/commit/8d410b7a500703080bb14ed7e3d2663fe16767e6"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/FelixSchwarz/mjml-python"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FelixSchwarz/mjml-python/releases/tag/v0.11.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-02-22T21:40:59Z",
    "nvd_published_at" : "2024-02-22T19:15:09Z"
  }
}