Skip to main content
VulnerabilityPublished Updated

CVE-2026-41316: ERB has an @_init deserialization guard bypass via def_module / def_method / def_class

Affects erbSource GCVE Database

0
Compare
Authoritative record:CVE-2026-41316· High 8.1

Not known to be exploited · CVSS 8.1 High : upgrade to 4.0.3.1 soon.

Data as of 17 Nov 2026, 23:04 UTC

CVSS 3.1 base score
8.1High
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 4.0.3.1, 4.0.4.1, 6.0.1.1 +1
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 24 Apr 2026

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponized: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 17 Nov 2026.

What to do

Upgrade to a fixed release listed under Affected software.

Affected software

ProductAffectedFixed in
RubyGemserbAffected
  • <4.0.3.1
Fixed in
  • 4.0.3.1
RubyGemserbAffected
  • >=4.0.4 <4.0.4.1
  • =4.0.4
Fixed in
  • 4.0.4.1
RubyGemserbAffected
  • >=5.0.0 <6.0.1.1
Fixed in
  • 6.0.1.1
RubyGemserbAffected
  • >=6.0.2 <6.0.4
Fixed in
  • 6.0.4

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

A patch is available and should be applied. Fixed versions are 4.0.3.1, 4.0.4.1, 6.0.1.1, and 6.0.4. Users should upgrade to these or later versions to mitigate this vulnerability. Until patched, avoid deserializing untrusted data with Marshal.load in applications that load ERB. The vendor advisory from Red Hat confirms the availability of fixes and recommends upgrading.

Description

A deserialization vulnerability in Ruby's ERB templating system allows attackers to bypass an instance variable guard designed to prevent code execution during deserialization. The flaw exists because certain public methods (def_method, def_module, def_class) evaluate template source code without checking the @_init guard, enabling remote code execution when untrusted data is deserialized. This can be exploited via crafted Marshal.load payloads, including gadget chains involving ActiveSupport proxies. The vulnerability affects multiple ERB versions prior to fixed releases and has a high severity CVSS score of 8.1.

References

Community reviews

Loading reviews…