{"id":"GHSA-5hrj-7fc3-cmx9","summary":"Mustache for Ruby: RCE using built-in method access","details":"\u003e [!NOTE]\n\u003e The vulnerability was fully disclosed to the maintainer in private prior to security advisories were enabled for the project.\n\u003e This advisory presents a limited information for initial release to provide a time window for installing updates. Full information with PoCs would be added later.\n\n## Summary\nMustache template engine for Ruby in versions 1.1.2 and earlier allows remote attackers to achieve arbitrary code execution through accessing specific built-in methods in an attacker-supplied template.\n\n## Details\nMustache is often suggested as a safe simple template language to avoid SSTI vulnerabilities.[^1] [^2]\n\nMustache 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.\n\n\u003e [!IMPORTANT]\n\u003e Successful exploitation of this vulnerability does not depend on any configuration or objects passed to the template engine.\n\u003e An attacker controlling the template string can achieve arbitrary code execution without any additional requirements.\n\nAdditional methods provided by the application or installed gems can further expand the attack surface but exploitation was proven without them.\n\n## PoC\nAll discovered payloads were tested using `ruby -e` shell commands with `mustache` as the only explicitly required gem:\n\n```bash\nruby -e 'require \"mustache\"; puts Mustache.render(\"PAYLOAD GOES HERE\", key: \"value\")'\n```\n\nFor initial information release, only the descriptions of the most important discovered payloads would be provided:\n- Universal RCE for a major Ruby version\n- File upload to RCE (3 different payloads)\n- Infinite memory consumption DoS\n- Infinite sleep DoS\n\nUniversal RCE payloads for other major Ruby versions and other payloads could exist, as the attack surface is very large. The presented list only contains payloads discovered using a fairly primitive approach.\n\n\u003e [!CAUTION]\n\u003e Exploitation is not limited to the discovered Exploits/PoCs and real-life web applications are likely to expose even more dangerous functionality.\n\n## Impact\nAn attacker with the ability to modify the template string can execute arbitrary code in the context of the Ruby application.\n\n## Rationale for CVSS assessment:\n\n- Attack Vector: Network\n\u003e No network requirements are present for exploitation.\n\u003e Templating functionality is often provided on public websites.\n- Attack Complexity: Low\n\u003e Attacker can expect reliable and repeatable exploitation.\n\u003e There are no requirements beyond attacker's control.\n- Privileges Required: None\n\u003e Mustache is often used for untrusted user-supplied templates.\n\u003e Exploitation is often possible without authorization or by using self-registered accounts (without prior privileges).\n\u003e Mustache by itself does not provide access control functionality.\n- User Interaction: None\n\u003e Exploitation does not require any user interaction to achieve RCE.\n- Scope: Unchanged\n\u003e The code is executed with the same privileges as the web application, without changing the scope.\n- Confidentiality Impact: High\n\u003e Arbitrary code execution leads to the total loss of confidentiality.\n- Integrity Impact: High\n\u003e Arbitrary code execution leads to the total loss of integrity.\n- Availability Impact: High\n\u003e Arbitrary code execution can be used to achieve the total loss of availability.\n\n## Resources\n[^1]: https://portswigger.net/knowledgebase/papers/serversidetemplateinjection.pdf\n[^2]: https://hackerone.com/reports/423541","aliases":["CVE-2026-130001"],"modified":"2026-11-18T16:45:05.033958431Z","published":"2026-11-18T16:28:29Z","database_specific":{"cwe_ids":["CWE-913"],"severity":"CRITICAL","github_reviewed":true,"github_reviewed_at":"2026-11-18T16:28:29Z","nvd_published_at":null},"references":[{"type":"WEB","url":"https://github.com/mustache/mustache/security/advisories/GHSA-5hrj-7fc3-cmx9"},{"type":"WEB","url":"https://github.com/mustache/mustache/commit/b015f866942a6eb45ce4d34009f2ba6ff16ce4c1"},{"type":"WEB","url":"https://hackerone.com/reports/423541"},{"type":"PACKAGE","url":"https://github.com/mustache/mustache"},{"type":"WEB","url":"https://portswigger.net/knowledgebase/papers/serversidetemplateinjection.pdf"}],"affected":[{"package":{"name":"mustache","ecosystem":"RubyGems","purl":"pkg:gem/mustache"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.1.3"}]}],"versions":["0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","0.10.0","0.11.0","0.11.1","0.11.2","0.12.0","0.12.1","0.13.0","0.2.0","0.2.1","0.2.2","0.3.0","0.3.1","0.3.2","0.4.0","0.4.1","0.4.2","0.5.0","0.5.1","0.6.0","0.7.0","0.9.0","0.9.1","0.9.2","0.98.0","0.99.0","0.99.1","0.99.2","0.99.3","0.99.4","0.99.5","0.99.6","0.99.7","0.99.8","1.0.0","1.0.1","1.0.2","1.0.3","1.0.5","1.1.0","1.1.1","1.1.2"],"database_specific":{"last_known_affected_version_range":"\u003c= 1.1.2","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-5hrj-7fc3-cmx9/GHSA-5hrj-7fc3-cmx9.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"}]}