CVE-2026-41316
High 8.1No known exploitationFix availableERB has an @_init deserialization guard bypass via def_module / def_method / def_class
Vendor advisory: GHSA-q339-8rmv-2mhv
Record last updated
CVSS score
High on a 0 to 10 scale
EPSS, chance of exploitation in 30 days
Higher than 68% of scored CVEs. A prediction, not evidence.
CISA remediation deadline
Not in the KEV catalog
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.
Weakness: CWE-693
Patching and mitigation
- Patch status
- Fix available (source: GitHub Advisory Database)
- Fix documented (source date)
- Mitigation
- None documented
- Vendor guidance
- access.redhat.com (opens in a new tab)
Affected products
| Vendor | Product | Affected versions | Fixed in | Per |
|---|---|---|---|---|
| ruby | erb | < 4.0.3.1 | Not documented | CVE Program |
| ruby | erb | = 4.0.4 | Not documented | CVE Program |
| ruby | erb | >= 5.0.0, < 6.0.1.1 | Not documented | CVE Program |
| ruby | erb | >= 6.0.2, < 6.0.4 | Not documented | CVE Program |
| rubygems | erb | from 5.0.0 before 6.0.1.1 | 6.0.1.1 | GitHub Advisory Database |
| rubygems | erb | from 6.0.2 before 6.0.4 | 6.0.4 | GitHub Advisory Database |
| rubygems | erb | 4.0.4 | 4.0.4.1 | GitHub Advisory Database |
| rubygems | erb | all versions before 4.0.3.1 | 4.0.3.1 | GitHub Advisory Database |
Timeline
Disclosure
CVE record published by GitHub_M
Source: CVE Program (opens in a new tab)
Patch
Fix documented by GitHub Advisory Database
Vendor guidance and references
- https://access.redhat.com/errata/RHSA-2026:18030 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:18039 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:18065 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:20596 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:20606 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:20614 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:20670 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:26312 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:26655 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:33462 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:33478 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:35834 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/errata/RHSA-2026:37238 (opens in a new tab)vendor-advisory, x_refsource_redhat
- https://access.redhat.com/security/cve/CVE-2026-41316 (opens in a new tab)vdb-entry, x_refsource_redhat
- RHBZ#2461369 (opens in a new tab)issue-tracking, x_refsource_redhat
- GitHub Advisory GHSA-q339-8rmv-2mhv (opens in a new tab)github-advisory
- https://github.com/ruby/erb/security/advisories/GHSA-q339-8rmv-2mhv (opens in a new tab)x_refsource_confirm
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-41316.json (opens in a new tab)x_sadp-csaf-vex