CVE-2026-41316: ERB has an @_init deserialization guard bypass via def_module / def_method / def_class
ERB is a templating system for Ruby. Ruby 2.7.0 (before ERB 2.2.0 was published on rubygems.org) introduced an `@_init` instance variable guard in `ERB#result` and `ERB#run` to prevent code execution when an ERB object is reconstructed via `Marshal.load` (deserialization). However, three other public methods that also evaluate `@src` via `eval()` were not given the same guard: `ERB#def_method`, `ERB#def_module`, and `ERB#def_class`. An attacker who can trigger `Marshal.load` on untrusted data in a Ruby application that has `erb` loaded can use `ERB#def_module` (zero-arg, default parameters) as a code execution sink, bypassing the `@_init` protection entirely. ERB 4.0.3.1, 4.0.4.1, 6.0.1.1, and 6.0.4 patch the issue.
Security readout for executives and security teams
Plain-English summary
CVE-2026-41316 is a high-severity Ruby ERB flaw. If a Ruby application deserializes untrusted Marshal data while ERB is loaded, an attacker may bypass ERB’s deserialization guard and reach code execution paths. The sources name fixed ERB releases, but do not show confirmed active exploitation.
Executive priority
Treat as high priority for Ruby environments that deserialize data. It can lead to code execution, but exploitation depends on a dangerous deserialization pattern. Prioritize exposed systems and services processing serialized Ruby objects.
Technical view
Ruby ERB added an @_init guard for ERB#result and ERB#run, but ERB#def_method, ERB#def_module, and ERB#def_class also evaluated @src and lacked the same guard. A deserialized ERB object could therefore bypass the intended protection. Patched versions are ERB 4.0.3.1, 4.0.4.1, 6.0.1.1, and 6.0.4.
Likely exposure
Exposure is likely limited to Ruby applications or platforms using affected ERB versions and performing Marshal.load on attacker-controlled or untrusted data. The highest-risk cases are internet-facing services, background job systems, or internal APIs that accept serialized Ruby objects.
Exploitation context
The source bundle indicates network attackability with high attack complexity and no required privileges or user interaction. Active exploitation is not established: KEV is false, and the provided sources do not cite exploitation in the wild.
Researcher notes
The key condition is unsafe Ruby Marshal deserialization with ERB present. The vulnerability is a guard coverage gap across ERB methods that evaluate template source. Evidence supports patched ERB versions and high severity, but does not establish public exploitation or broad exposure.
Mitigation direction
Upgrade ERB to a patched version named by the advisory.
Apply relevant Red Hat errata where using affected Red Hat packages.
Remove or block Marshal.load on untrusted data.
Audit deserialization boundaries and prefer safe data formats.
Follow vendor guidance for Ruby runtime or packaged dependency updates.
Validation and detection
Inventory Ruby applications and ERB versions in dependency metadata.
Review code paths that call Marshal.load or equivalent deserialization.
Confirm whether ERB is loaded in services accepting serialized input.
Verify patched ERB versions are deployed after updates.
Check vendor advisories for distribution-specific package status.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-502: Code execution behavior lookup
Code execution and unsafe deserialization weaknesses often justify reviewing execution behavior and process telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
5Timeline events
2ADP providers
18Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-502 · source CWE mapping
Deserialization of Untrusted Data
Deserialization of Untrusted Data represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Protection Mechanism Failure represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.