Summary
Versions 1.1.2 and earlier of the mustache Ruby gem allow a remote attacker who controls the template being rendered to execute arbitrary code. The CVSS 3.1 score given is 9.8 (critical).
What happened
Mustache for Ruby, up to version 1.1.2, did not properly restrict method access, which allowed chaining multiple built-in methods to achieve arbitrary code execution through an attacker-supplied template. According to the source, exploitation does not depend on any configuration or objects passed to the template engine; controlling the template string is enough. The source adds that methods provided by the application or installed gems can expand the attack surface, and that denial-of-service impacts (memory consumption and indefinite sleep) are also described besides code execution. The original advisory states that it is published with limited information to give a time window for installing updates. It is associated with CWE-913 and the identifiers CVE-2026-130001 and GHSA-5hrj-7fc3-cmx9.
Why it matters
An attacker able to modify the template can execute arbitrary code with the privileges of the Ruby application. The source notes that Mustache is often used with untrusted, user-supplied templates. The CVSS 3.1 score is 9.8, with vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, and severity is critical. The source does not indicate known active exploitation; it is not listed in CISA's KEV catalog.
Affected products and versions
mustache gem (rubygems ecosystem), versions <= 1.1.2. The fixed version indicated is 1.1.3.
| Product | Versions | Fixed in |
|---|---|---|
| mustache | <= 1.1.2 | 1.1.3 |
Action recommended by the source
The vendor indicates that the fixed version is 1.1.3, so it recommends updating to that version or later. The source does not mention other mitigations.
Fixed in: 1.1.3
Sources and references
- https://github.com/advisories/GHSA-5hrj-7fc3-cmx9 — GHSA
- https://github.com/mustache/mustache/security/advisories/GHSA-5hrj-7fc3-cmx9 — GHSA
- https://github.com/mustache/mustache/commit/b015f866942a6eb45ce4d34009f2ba6ff16ce4c1 — GHSA
- https://hackerone.com/reports/423541 — GHSA
- https://portswigger.net/knowledgebase/papers/serversidetemplateinjection.pdf — GHSA
Weaknesses (CWE): CWE-913
Relevant change history
Published
Advisory published.