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

- Severity: High 8.1 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.15%, higher than 67% of CVEs (2026-12-02)
- Published: 2026-04-24T02:35:41.160Z
- Modified: 2026-11-17T22:00:04.372Z
- Also known as: GHSA-q339-8rmv-2mhv
- Weaknesses: CWE-502, CWE-693
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact total
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- ruby erb: < 4.0.3.1; = 4.0.4; >= 5.0.0, < 6.0.1.1; >= 6.0.2, < 6.0.4
- ruby: no versions given (not affected: from 0:3.3.10-12.el10_1 before *; from 0:3.3.10-11.el10_0.1 before *; from 0:3.0.7-166.el9_7 before *; from 0:3.0.4-160.2.el9_0 before *; from 0:3.0.4-161.el9_2.3 before *; from 0:3.0.7-162.el9_4.2 before *; from 0:3.0.7-165.el9_6.1 before *)
- ruby4.0: no versions given (not affected: from 0:4.0.3-34.el10_2 before *)
- ruby:3.3: no versions given (not affected: from 8100020260428163940.489197e6 before *; from 9070020260428163621.9 before *; from 9040020260520083544.9 before *; from 9060020260630075016.9 before *)
- ruby:4.0: no versions given (not affected: from 9080020260513131334.9 before *)
- ruby:2.5/ruby: no versions given
- ruby3.3: no versions given
- ruby3.4: no versions given
- openshift/ose-rhel-coreos-9: no versions given
- erb (RubyGems): before 4.0.3.1; from 4.0.4 before 4.0.4.1; from 5.0.0 before 6.0.1.1; from 6.0.2 before 6.0.4

## Every score

- GitHub_M: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- redhat-SADP: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- GitHub: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://github.com/ruby/erb/security/advisories/GHSA-q339-8rmv-2mhv> (web)
- <https://access.redhat.com/security/cve/CVE-2026-41316> (vdb-entry, web)
- <https://bugzilla.redhat.com/show_bug.cgi?id=2461369> (issue-tracking, web)
- <https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-41316.json> (web)
- <https://access.redhat.com/errata/RHSA-2026:33478> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:18065> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:20606> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:20614> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:20670> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:35834> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:26312> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:26655> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:33462> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:37238> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:18039> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:18030> (vendor-advisory, web)
- <https://access.redhat.com/errata/RHSA-2026:20596> (vendor-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-41316> (advisory)
- <https://github.com/ruby/erb/commit/ef61b591b270f8ba58d47f12472a1c53a77b4d61> (web)
- <https://github.com/ruby/erb/commit/dd34ce41031327269a5fb83b0bc2c0d852895e9f> (web)
- <https://github.com/ruby/erb/commit/c3b721f7f7570c23e3423590af0419c1b10e1255> (web)
- <https://github.com/ruby/erb/commit/9d017be4e375cdd058650ce528ee6adfead20cac> (web)
- <https://www.ruby-lang.org/en/news/2026/04/21/erb-cve-2026-41316> (web)
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/erb/CVE-2026-41316.yml> (web)
- <https://github.com/ruby/erb> (package)

## Sources

- CVE List: [CVE-2026-41316](https://www.cve.org/CVERecord?id=CVE-2026-41316), CVE Terms of Use, modified 2026-08-24
- GitHub Advisory Database: [GHSA-q339-8rmv-2mhv](https://github.com/advisories/GHSA-q339-8rmv-2mhv), CC-BY-4.0, modified 2026-11-17
- NVD: [CVE-2026-41316](https://nvd.nist.gov/vuln/detail/CVE-2026-41316), Public domain, modified 2026-10-26

---

Page: https://cve.day/CVE-2026-41316 · Whole record: https://cve.day/CVE-2026-41316.json · Rebuilt by cve.day 2026-11-25T22:59:19.452Z
