LiveActive security incident?Get immediate response
CVE Record

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.

HighCVSS 8.1Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

A flaw in Ruby's ERB library can let an attacker execute code when an application deserializes attacker-controlled data using Marshal.load. Exploitation requires a specific unsafe application behavior, but successful exploitation could compromise data, integrity, and service availability.

Executive priority

Treat this as a high-priority patching and code-review issue for internet-facing or multi-tenant Ruby services. Accelerate remediation where untrusted Marshal deserialization exists. Systems that do not deserialize untrusted data remain lower priority, but should still upgrade during the normal security cycle.

Technical view

The @_init guard in ERB#result and ERB#run does not protect ERB#def_method, ERB#def_module, or ERB#def_class, which also evaluate @src. A crafted ERB object reconstructed through untrusted Marshal.load can therefore reach a code-execution sink. CVSS 3.1 is 8.1, reflecting network reachability, high complexity, no privileges, no user interaction, and high impact.

Likely exposure

Exposure is limited to Ruby applications using affected ERB versions, with erb loaded, that pass untrusted or attacker-influenced data to Marshal.load. Merely using ERB does not establish exploitability. Affected ranges are below 4.0.3.1, 4.0.4, 5.0.0 through 6.0.1, and 6.0.2 through 6.0.3.

Exploitation context

The source bundle does not report CISA KEV listing or confirmed active exploitation. Exploitation is remotely reachable in some deployments but rated high complexity because it depends on an application exposing unsafe Ruby Marshal deserialization with ERB available.

Researcher notes

This is a guard-coverage failure rather than a general ERB template-injection issue. Assessment should focus on the intersection of a vulnerable ERB version, loaded ERB code, attacker-influenced Marshal data, and a reachable deserialization path. Public sources provided here do not establish exploitation in the wild.

Mitigation direction

  • Upgrade ERB to 4.0.3.1, 4.0.4.1, 6.0.1.1, 6.0.4, or a later vendor-supported release.
  • Prioritize applications that deserialize data influenced by external users, services, queues, caches, or stored sessions.
  • Eliminate Marshal.load for untrusted data and use a serialization format that cannot reconstruct executable Ruby objects.
  • Apply relevant Red Hat errata when ERB is supplied through affected Red Hat packages.

Validation and detection

  • Inventory ERB gem and operating-system package versions across production, development, CI, and container images.
  • Review code paths calling Marshal.load and determine whether any input can be influenced outside the trust boundary.
  • Confirm the deployed dependency resolves to a patched ERB version, including bundled or transitive copies.
  • Retest affected deserialization workflows after upgrading without constructing or executing a malicious payload.
Prepared
Confidence
high
Sources
5

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.

Open ATT&CK lookup
cwe · low confidence lookup

CWE-693: Exact CWE lookup

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.

Open ATT&CK lookup
description · low confidence lookup

Execution behavior lookup

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.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2026-41316 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
High
CVSS
8.1 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

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.

ScoreVersionSeverityVectorExploitImpactSource
8.1CVSS 3.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H2.25.9GitHub_M
8.1CVSS 3.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H2.25.9redhat-SADP

Vulnerability scoring details

Base CVSS 3.1 score

8.1High
CVSS 3.1 vector shape for CVE-2026-41316Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone

Vulnerability timeline

Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.

  1. CVE reservedCVE Program

    The CVE ID was reserved by the assigning CNA.

  2. ADP timelineredhat-SADP

    Made public.

  3. CVE publishedCVE Program

    The CVE record was published.

  4. ADP timelineredhat-SADP

    Reported to Red Hat.

  5. CVE updatedCVE Program

    The CVE record metadata indicates this as the latest update time.

ADP provider summaries

CISA-ADPCISA ADP Vulnrichment
other:ssvc
redhat-SADPerb: ERB: Arbitrary code execution via deserialization bypass
other:Red Hat severity ratingcvssV3_1
  • 2026-04-24T03:01:16.620Z: Reported to Red Hat.
  • 2026-04-24T02:35:41.160Z: Made public.

Source materials

Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
rubyerb< 4.0.3.1, = 4.0.4, >= 5.0.0, < 6.0.1.1, >= 6.0.2, < 6.0.4Listed
Weakness

CWE details

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.

CWE-693 · source CWE mapping

Protection Mechanism Failure

Protection Mechanism Failure represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.