CVE-2026-41316: ERB has an @_init deserialization guard bypass via def_module / def_method / def_class
Vulnerability summary
CVE-2026-41316 is a high (CVSS 8.1) Protection Mechanism Failure vulnerability in ruby erb. EPSS estimates a 1.13% chance of exploitation in the next 30 days, higher than 66.4% of scored vulnerabilities.
Severe, CVSS 8.1 (CVE.org); no exploitation reported by the 5 checked sources; EPSS 1% (FIRST, 03-11-2026)
Source freshness unavailable
How is this decided?Advisory lineage
Upstream 0 · Downstream 6 · Related 2Timeline
- 24-04-2026PublishedVulnerability first disclosed.
- 24-08-2026Last modifiedVulnerability information updated.
Description
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.
CVSS metrics
9 scores · 9 sources · 1 version- OSV · Red hatEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- OSV · UbuntuEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- OSV · DebianEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- OSV · WolfiEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- OSV · ChainguardEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- OSV · RubygemsEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- NVDNIST8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- OSV · AlpineEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS trend
Probability
1.13%
Chance of exploitation in the next 30 days
Percentile
66%
Versus all other CVEs
30-day change
Decrease -0.17 pp
From 1.31% on 04-10-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root cause- CWE-693Protection Mechanism FailureThe product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
- CWE-502Deserialization of Untrusted DataThe product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.
Affected systems
Known conditions: network-reachable, no authentication, no user interaction (CVSS vector). Other conditions: not stated in public data.
Redhat44 products
- ruby< 0:3.3.10-11.el10_0.1 | < 0:3.3.10-6.module+el9.7.0+24248+66578cbb | < 0:3.0.7-166.el9_7 | < 0:3.3.10-12.el10_1 | < 0:3.3.10-6.module+el8.10.0+24247+b74f0fb8 | < 0:3.0.4-160.2.el9_0 | < 0:3.0.7-162.el9_4.2 | < 0:3.3.10-6.module+el9.4.0+24333+ed4ca411
- ruby-bundled-gems< 0:3.3.10-11.el10_0.1 | < 0:3.3.10-6.module+el9.7.0+24248+66578cbb | < 0:3.3.10-12.el10_1 | < 0:3.3.10-6.module+el8.10.0+24247+b74f0fb8 | < 0:3.3.10-6.module+el9.4.0+24333+ed4ca411
- ruby-bundled-gems-debuginfo< 0:3.3.10-11.el10_0.1 | < 0:3.3.10-6.module+el9.7.0+24248+66578cbb | < 0:3.3.10-12.el10_1 | < 0:3.3.10-6.module+el8.10.0+24247+b74f0fb8 | < 0:3.3.10-6.module+el9.4.0+24333+ed4ca411
- ruby-debuginfo< 0:3.3.10-11.el10_0.1 | < 0:3.3.10-6.module+el9.7.0+24248+66578cbb | < 0:3.0.7-166.el9_7 | < 0:3.3.10-12.el10_1 | < 0:3.3.10-6.module+el8.10.0+24247+b74f0fb8 | < 0:3.0.4-160.2.el9_0 | < 0:3.0.7-162.el9_4.2 | < 0:3.3.10-6.module+el9.4.0+24333+ed4ca411
- ruby-debugsource< 0:3.3.10-11.el10_0.1 | < 0:3.3.10-6.module+el9.7.0+24248+66578cbb | < 0:3.0.7-166.el9_7 | < 0:3.3.10-12.el10_1 | < 0:3.3.10-6.module+el8.10.0+24247+b74f0fb8 | < 0:3.0.4-160.2.el9_0 | < 0:3.0.7-162.el9_4.2 | < 0:3.3.10-6.module+el9.4.0+24333+ed4ca411
Chainguard37 products
- jruby-10.1< 10.1.1.0-r0
- jruby-9.4< 9.4.15.0-r0
- logstash-8.19< 8.19.19-r0
- logstash-8.19-iamguarded-compat< 8.19.19-r0
- logstash-8.19-with-output-opensearch< 8.19.19-r0
Wolfi13 products
- jruby-10.1< 10.1.1.0-r0
- jruby-9.4< 9.4.15.0-r0
- logstash-9.3< 9.3.4-r2
- logstash-9.3-iamguarded-compat< 9.3.4-r2
- logstash-9.3-with-output-opensearchAll versions (No fix recorded)
Ubuntu7 products
- jrubyAll versions (No fix recorded)
- ruby2.3All versions (No fix recorded)
- ruby2.5All versions (No fix recorded)
- ruby2.7All versions (No fix recorded)
- ruby3.0All versions (No fix recorded)
Debian2 products
- ruby3.1All versions (No fix recorded)
- ruby3.3All versions (No fix recorded)
Alpine1 product
- ruby< 3.3.13-r0
Opensuse1 product
- ruby4.0&distro=openSUSE Tumbleweed< 4.0.3-1.1
Ruby1 product
- erb< 4.0.3.1 | = 4.0.4 | ≥ 5.0.0, < 6.0.1.1 | ≥ 6.0.2, < 6.0.4
RubyGems1 product
- erb< 4.0.3.1 | ≥ 4.0.4, < 4.0.4.1 | ≥ 5.0.0, < 6.0.1.1 | ≥ 6.0.2, < 6.0.4
Suse1 product
- ruby2.5&distro=SUSE Linux Enterprise Module for Basesystem 15 SP7< 2.5.9-150700.24.11.1
10 vendors · 108 products
References
37 links- github.com/ruby/erb/security/advisories/GHSA-q339-8rmv-2mhvX Refsource CONFIRMARTICLEREPORTAdvisoryWEB
Show all 37 references
- github.com/ruby/erbPACKAGE