CVE-2026-41316: ERB has an @_init deserialization guard bypass via def_module / def_method / def_class
Affects erbSource GCVE Database
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
- 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:HExploitation evidence
Disclosed: evidence found.
CVE published 24 Apr 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by 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.
Patches and advisories
- access.redhat.com/errata/RHSA-2026:37238 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:35834 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:33478 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:33462 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:26655 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:26312 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:20670 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:20614 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:20606 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:20596 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:18065 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:18039 (opens in a new tab)
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| RubyGemserb | Affected
| Fixed in
|
| RubyGemserb | Affected
| Fixed in
|
| RubyGemserb | Affected
| Fixed in
|
| RubyGemserb | Affected
| Fixed in
|
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
- github.com/ruby/erb/security/advisories/GHSA-q339-8rmv-2mhv (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-41316 (opens in a new tab)
- github.com/ruby/erb/commit/ef61b591b270f8ba58d47f12472a1c53a77b4d61 (opens in a new tab)
- github.com/ruby/erb/commit/dd34ce41031327269a5fb83b0bc2c0d852895e9f (opens in a new tab)
- github.com/ruby/erb/commit/c3b721f7f7570c23e3423590af0419c1b10e1255 (opens in a new tab)
- github.com/ruby/erb/commit/9d017be4e375cdd058650ce528ee6adfead20cac (opens in a new tab)
- ruby-lang.org/en/news/2026/04/21/erb-cve-2026-41316 (opens in a new tab)
- security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-41316.json (opens in a new tab)
- github.com/rubysec/ruby-advisory-db/blob/master/gems/erb/CVE-2026-41316.yml (opens in a new tab)
- github.com/ruby/erb (opens in a new tab)
- bugzilla.redhat.com/show_bug.cgi?id=2461369 (opens in a new tab)
- access.redhat.com/security/cve/CVE-2026-41316 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:37238 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:35834 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:33478 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:33462 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:26655 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:26312 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:20670 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:20614 (opens in a new tab)