{"id":"CVE-2026-41316","published":"2026-04-24T02:35:41Z","modified":"2026-08-24T12:06:46Z","title":"ERB has an @_init deserialization guard bypass via def_module / def_method / def_class","vendor":"ruby","product":"erb","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.1,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01148,"percentile":0.67605,"provenance":"source"},"cwes":[{"id":"CWE-693","name":"Protection Mechanism Failure"},{"id":"CWE-502","name":"Deserialization of Untrusted Data"}],"references":[{"url":"https://github.com/ruby/erb/security/advisories/GHSA-q339-8rmv-2mhv","tags":["x_refsource_CONFIRM"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-41316","tags":["vdb-entry","x_refsource_REDHAT"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2461369","tags":["issue-tracking","x_refsource_REDHAT"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-41316.json","tags":["x_sadp-csaf-vex"]},{"url":"https://access.redhat.com/errata/RHSA-2026:33478","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:18065","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:20606","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:20614","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:20670","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:35834","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:26312","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:26655","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:33462","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:37238","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:18039","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:18030","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:20596","tags":["vendor-advisory","x_refsource_REDHAT"]}],"priority":{"score":19.2,"factors":[{"name":"EPSS percentile","points":13.52},{"name":"CVSS severity","points":5.67}]},"vendorSlug":"ruby","affectedVersions":[{"vendor":"ruby","product":"erb","versions":["< 4.0.3.1","= 4.0.4",">= 5.0.0, < 6.0.1.1",">= 6.0.2, < 6.0.4"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2026-04-25T01:45:02.467085Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"RubyGems","package":"erb","vulnerableRanges":["<4.0.3.1",">=4.0.4, <4.0.4.1",">=5.0.0, <6.0.1.1",">=6.0.2, <6.0.4"],"patched":["4.0.3.1","4.0.4.1","6.0.1.1","6.0.4"],"from":["GHSA-q339-8rmv-2mhv"],"provenance":"source"}],"summary":{"text":"The erb library for Ruby contains a flaw in which the @_init guard that blocks code execution during Marshal.load deserialization is not applied to the ERB#def_method, ERB#def_module and ERB#def_class methods, which also evaluate template source. An attacker who can get an application with erb loaded to deserialize untrusted data via Marshal.load can exploit this over the network with no authentication or user interaction, though the attack is considered high complexity, to run arbitrary code.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T07:17:37Z"},"euvd":{"id":"EUVD-2026-25385","exploited":false,"provenance":"source"}}