CVE-2020-12827: Mjml Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-4hch-r9xf-6vfr
CVSS 7.2
CWE-22
Published
Advisory Summary

CVE-2020-12827 is a HIGH (CVSS 7.2) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Mjml libraries in the npm ecosystem. The issue involves mjml vulnerable to path traversal. Remediation is available by upgrading affected packages to version 4.6.3.

CVE-2020-12827 at a Glance

CVE Identifier CVE-2020-12827
GHSA Identifier GHSA-4hch-r9xf-6vfr
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Mjml
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.2

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

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

How to Fix CVE-2020-12827

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: 4.6.3
npm install mjml@4.6.3
Verify Direct and Transitive Dependencies

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

npm ls mjml

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2020-12827, inspect your project dependencies using npm:

npm ls 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 4.6.3), your application is affected.

Note: The npm ls mjml command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. 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

MJML prior to 4.6.3 contains a path traversal vulnerability when processing the `mj-include` directive within an MJML document.

CVE-2020-12827 Affected Mjml Versions

1 component(s)
Fixed Versions:
4.6.3
Product / Package Ecosystem Affected Versions Fixed Version
mjml
npm
< 4.6.3
4.6.3

References

Frequently Asked Questions

What is CVE-2020-12827?
CVE-2020-12827 is a security vulnerability in Mjml involving MJML vulnerable to path traversal under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Mjml versions are affected?
Affected versions include releases prior to 4.6.3 across affected packages: mjml.
What version fixes CVE-2020-12827?
Upgrading to 4.6.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mjml affected?
Yes, mjml is affected in releases prior to 4.6.3. Upgrade your dependency to 4.6.3 or later.
What is the CVSS score of CVE-2020-12827?
CVE-2020-12827 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:L.
What CWE is associated with CVE-2020-12827?
CVE-2020-12827 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for CVE-2020-12827?
Run the dependency tree command: 'npm ls 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-4hch-r9xf-6vfr",
  "modified" : "2023-10-19T19:05:11Z",
  "published" : "2022-05-24T17:20:46Z",
  "aliases" : [ "CVE-2020-12827" ],
  "summary" : "MJML vulnerable to path traversal",
  "details" : "MJML prior to 4.6.3 contains a path traversal vulnerability when processing the `mj-include` directive within an MJML document.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mjml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.6.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-12827"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mjmlio/mjml/commit/30e29ed2cdaec8684d60a6d12ea07b611c765a12"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mjmlio/mjml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mjmlio/mjml/releases/tag/v4.6.3"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/158111/MJML-4.6.2-Path-Traversal.html"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/fulldisclosure/2020/Jun/23"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-10-19T19:05:11Z",
    "nvd_published_at" : "2020-06-17T14:15:00Z"
  }
}