CVE-2022-0323: Mustache/mustache Mustache Remote Code Injection Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-4rmr-c2jx-vx27
CVSS 8.8
CWE-94 CWE-1336
Published
Advisory Summary

CVE-2022-0323 is a HIGH (CVSS 8.8) mustache remote code injection vulnerability vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Mustache/mustache libraries in the Packagist ecosystem. The issue involves mustache remote code injection vulnerability. Remediation is available by upgrading affected packages to version 2.14.1.

CVE-2022-0323 at a Glance

CVE Identifier CVE-2022-0323
GHSA Identifier GHSA-4rmr-c2jx-vx27
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Mustache/mustache
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:N/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2022-0323

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

mustache/mustache fixed: 2.14.1
Upgrade mustache/mustache to 2.14.1
Verify Direct and Transitive Dependencies

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

inspect dependencies for mustache/mustache

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-0323, inspect your project dependencies for Mustache/mustache:

inspect dependencies for mustache/mustache

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Mustache/mustache, 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

In Mustache.php v2.0.0 through v2.14.0, Sections tag can lead to arbitrary php code execution even if strict_callables is true when section value is controllable.

CVE-2022-0323 Affected Mustache/mustache Versions

1 component(s)
Fixed Versions:
2.14.1
Product / Package Ecosystem Affected Versions Fixed Version
mustache/mustache
Packagist
≥ 2.0.0
< 2.14.1
2.14.1

References

Frequently Asked Questions

What is CVE-2022-0323?
CVE-2022-0323 is a security vulnerability in Mustache/mustache involving Mustache remote code injection vulnerability under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Mustache/mustache versions are affected?
Affected versions include releases prior to 2.14.1 across affected packages: mustache/mustache.
What version fixes CVE-2022-0323?
Upgrading to 2.14.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mustache/mustache affected?
Yes, mustache/mustache is affected in releases prior to 2.14.1. Upgrade your dependency to 2.14.1 or later.
What is the CVSS score of CVE-2022-0323?
CVE-2022-0323 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-0323?
CVE-2022-0323 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Packagist dependencies for CVE-2022-0323?
Run the dependency tree command: 'inspect dependencies for mustache/mustache'. 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-4rmr-c2jx-vx27",
  "modified" : "2022-08-11T17:05:16Z",
  "published" : "2022-01-27T14:51:00Z",
  "aliases" : [ "CVE-2022-0323" ],
  "summary" : "Mustache remote code injection vulnerability",
  "details" : "In Mustache.php v2.0.0 through v2.14.0, Sections tag can lead to arbitrary php code execution even if strict_callables is true when section value is controllable.\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "mustache/mustache"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.14.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-0323"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bobthecow/mustache.php/commit/579ffa5c96e1d292c060b3dd62811ff01ad8c24e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/mustache/mustache/CVE-2022-0323.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/bobthecow/mustache.php"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bobthecow/mustache.php/releases/tag/v2.14.1"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/a5f5a988-aa52-4443-839d-299a63f44fb7"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1336", "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-24T23:01:39Z",
    "nvd_published_at" : "2022-01-21T18:15:00Z"
  }
}