GitHub’s reviewed advisory GHSA-5hrj-7fc3-cmx9 (CVE-2026-130001), updated November 18, 2026, assigns CVSS 9.8 to the Ruby mustache gem through 1.1.2: an attacker who controls the template string can chain built-in methods and reach arbitrary code execution without needing extra objects from your application. The patched release is 1.1.3. Maintainer notes on the advisory say full PoCs will arrive later after an initial patch window—upgrade now, do not wait for public exploit code.
If coding agents maintain Ruby services—Rails mailers, static-site generators, admin “custom template” fields, or offline report jobs—this is the same class of bug as fastapi-code-generator OpenAPI RCE and other template-injection issues in the 2026 CVE surge: the dangerous input is structure, not a classic SQL string.
TL;DR
| Question | Answer |
|---|---|
| Am I affected? | mustache gem ≤ 1.1.2 in any Gemfile.lock or container image |
| Is there a fix? | mustache 1.1.3 on RubyGems (advisory) |
| Network exploitable? | Yes — advisory scopes Attack Vector: Network, Privileges: None |
| Need app secrets in the template context? | No — exploitation does not depend on objects you pass in |
| Does data leave my machine? | RCE runs on the server that renders the template |
| Agent angle? | Agents that bundle update, scaffold mailers, or add “user themes” can reintroduce ≤1.1.2 |
Mechanism: “logic-less” templates with unrestricted method access
Mustache markets itself as a logic-less template language—no arbitrary code in the template syntax itself. Security guides often recommend Mustache over heavier engines to avoid server-side template injection (SSTI). The advisory’s core finding is that Ruby’s Mustache implementation through 1.1.2 did not properly restrict method access, so an attacker who supplies the template can still walk Ruby’s object graph through built-in methods and end in arbitrary code execution.
GitHub’s text is explicit on prerequisites:
Successful exploitation of this vulnerability does not depend on any configuration or objects passed to the template engine.
An attacker controlling the template string can achieve arbitrary code execution without any additional requirements.
That matters for threat modeling. Defenses like “we only pass a small hash of user fields” or “we sandbox the context object” do not address this flaw if the template body is attacker-controlled—forum signatures, emailed HTML widgets, multi-tenant themes, agent-generated .mustache files in a repo, and similar.
The reporter vladko312 documented rediscovery of classic SSTI literature (PortSwigger’s server-side template injection paper) and an earlier Mustache disclosure on HackerOne report 423541, cited in the advisory references. CWE mapping is CWE-913 — improper control of dynamically managed code resources.
What the maintainer withheld (for now)
The advisory’s note block explains limited initial disclosure so operators can patch before full exploit detail ships:
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.
Published payload categories (descriptions only, not full strings) include:
- Universal RCE for a major Ruby version
- File upload to RCE (three variants)
- Infinite memory consumption DoS
- Infinite sleep DoS
GitHub also warns that methods from the application and installed gems can enlarge the attack surface, and that the listed PoCs came from a “fairly primitive” search—production apps may be worse.
Verification command from the advisory (paraphrased for local testing):
require "mustache"
puts Mustache.render("PAYLOAD GOES HERE", key: "value")
Teams should run that pattern only in isolated lab VMs, not on production consoles.
Disclosure timeline
| Date | Event |
|---|---|
| (prior) | Maintainer notified privately before advisories were enabled (advisory note) |
| 2026-08-20 | Advisory record published to mustache/mustache per GitHub timeline |
| 2026-11-18 | GitHub Advisory Database Reviewed entry updated publicly |
| Not yet dated | Full PoCs promised on the advisory page |
Fix reference in the advisory: commit mustache/mustache@b015f86 (linked from GHSA resources).
Who is affected
| Pattern | Risk |
|---|---|
| User-editable Mustache templates (themes, emails, CMS fields) on ≤1.1.2 | Critical — template string is attacker-controlled |
Agent opens PR that adds mustache ~> 1.1.0 without lockfile pin | High if CI does not gate versions |
| Only server-side fixed templates in your repo, gem patched | Lower for this specific CVE, but keep gem current |
| No Ruby / no mustache in Gemfile.lock | Not affected by this CVE id |
The gem is widely used wherever Ruby stacks render Mustache—not only huge frameworks. Any microservice an agent scaffolded with a Gemfile deserves the same bundle show mustache pass as production Rails.
What this means if you run AI coding agents
Coding agents increasingly edit dependency manifests and templating code in the same session:
grep -r mustacheacross repos agents touch; include forked internal gems that vendor Mustache.bundle show mustache(orbundle info mustache) in CI, Docker build, and local dev—the JVM inside Kubernetes is not the only runtime that matters if a sidecar renders Ruby templates.- Block agent merges that add
Mustache.render(user_template, …)without routing templates through a reviewed allowlist—even after 1.1.3, the advisory’s caution about expanded method surfaces still applies. - Cross-check MCP and skill supply-chain hygiene when agents pull “email template” skills that embed Ruby example code; a skill that pins old mustache versions propagates the CVE into many workspaces.
Related template-injection context: HTTP header prompt injection study shows how untrusted text enters pipelines in non-obvious places; Mustache is the same lesson for server renderers.
Version checks (copy-paste)
bundle show mustache
grep -E 'mustache \(' Gemfile.lock
gem list mustache
After upgrade:
bundle update mustache
bundle exec ruby -e 'require "mustache"; puts Mustache::VERSION'
Confirm output reports 1.1.3 or newer before redeploying any service that renders templates from users or from agent commits.
CVSS 9.8 without “extra” objects
GitHub’s published vector is CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. For incident triage:
| Metric | Value | Why it matters for agents |
|---|---|---|
| Attack vector | Network | Any public “render my template” API qualifies |
| Attack complexity | Low | No race or race-window described in the advisory |
| Privileges required | None | Self-serve signup + template upload is enough |
| User interaction | None | Server-side render only |
| Impact | High on C/I/A | Full process compromise |
Teams that rated Mustache “safe because we use logic-less templates” should reopen risk registers. The advisory’s CWE-913 mapping is about dynamic code resources—the template runtime becomes a code gadget even when the template syntax looks innocent.
Common deployment patterns that break
| Pattern | Why ≤1.1.2 is dangerous |
|---|---|
Multi-tenant email themes in Rails Mustache.render | Tenants supply .mustache bodies |
| Report export where analysts paste templates | Paste becomes remote template injection |
| Agent-generated mailer partials in a PR | Merge bot does not know SSTI |
| Static site generators with user skins | Skin file == template string |
| Preview servers on developer laptops | LAN exposure still “network” if routed |
None of these require the attacker to steal session cookies first—they need only influence template content the server will render.
How to tell if you were hit (before public PoCs)
Without published exploit strings, forensics is version- and exposure-based:
- Inventory every host that ran
Mustache.renderon non-admin templates in the last 90 days. - Correlate web logs for spikes on template save/render endpoints with process anomalies (
rubychild shells)—noisy but better than nothing. - Assume compromise if ≤1.1.2 was internet-facing and untrusted users could post templates—rotate app secrets and rebuild VMs even without an IOC.
After 1.1.3, repeat bundle show mustache on each deploy target; agents love bumping patch versions in one repo while leaving docker images stale.
Comparisons readers ask about
| Engine | This CVE? |
|---|---|
| Ruby mustache gem | Yes — CVE-2026-130001 |
| Ruby mustache in vendor forks | Check lockfile; gem name may differ |
| pystache / Python ports | Separate packages — run their audits |
| handlebars / erb in the same app | Different CVE lifecycle |
| LLM prompt templates | Different class—see header injection study |
Do not dismiss the bug because your stack is “mostly Python.” Ruby microservices beside agent tooling are common for billing, mail, and admin UIs.
Patch verification in CI
Add a failing gate agents cannot silence without review:
# Example: fail CI when mustache is below floor (adapt to your parser)
- run: |
ver=$(bundle show mustache 2>/dev/null | sed -n 's/.*mustache-\([0-9.]*\).*/\1/p')
test -n "$ver" || exit 0
ruby -e "require 'rubygems'; abort if Gem::Version.new('$ver') < Gem::Version.new('1.1.3')"
Pair with bundle audit or brakeman where Rails renders Mustache—static tools may not catch runtime template sources, but they catch forgotten gems.
Maintainer timeline and downstream mirrors
The GitHub advisory timeline shows a 2026-08-20 publication on the repository and a 2026-11-18 “Reviewed” refresh in the Advisory Database—suggesting maintainers had months to patch before the public database entry many scanners ingest. If your agent workflow only watches NVD or OSV feeds, confirm whether your mirror already ingested GHSA-5hrj-7fc3-cmx9; do not assume absence in an old CSV export means the gem is safe.
RubyGems mirrors and Docker layer caches can serve stale mustache builds even after upstream yanks nothing (the advisory does not describe a yank—only a fixed 1.1.3). Rebuild images with --no-cache when bumping this gem, especially on CI runners that caching agents reuse across customers.
What Beam can and cannot do here
Beam is built around local coding agents (Claude Code, Codex, and similar), not Ruby application servers. It does not scan Gemfile.lock or patch Rubygems for you.
What still helps on the agent laptop:
- PreToolUse hooks can flag when an agent proposes
bundle updatewithout a version pin or runs destructiverm -rfduring incident response. - Skill and MCP config scanning applies heuristic patterns (including risky
curl | bashand broad network exfil instructions) before you run third-party skills that teach templating shortcuts. - On-device audit trails show whether an agent edited a
*.mustachefile or loosened template sandboxing in the same session as a dependency bump.
Beam cannot replace WAF rules, template allowlists, or bundle audit in CI. It is not a kernel sandbox for Ruby processes.
Related reading
- CVE-2026-63470: fastapi-code-generator call-time RCE
- CVE-2026-63471 and CVE-2026-63469: import-time RCE in the same generator
- CVE volume in 2026: why patching cadence matters for agent users
- Practical MCP security guide
- Beam agent runtime security for local action monitoring
Frequently asked questions
The FAQ entries in the front matter answer version checks, configuration dependence, and cross-language scope; see the questions there for quick scanning.
Sources
- GitHub Advisory GHSA-5hrj-7fc3-cmx9 / CVE-2026-130001
- mustache/mustache fix commit b015f86
- PortSwigger — Server-Side Template Injection
- HackerOne report 423541 (historical Mustache context cited by GitHub)
Version numbers, CVSS, and affected ranges are accurate as of November 18, 2026, per the GitHub Advisory Database entry.

