CVE-2026-41316 ERB has an @_init deserialization guard bypass via def_module / def_method / def_class
HighCVSS 8.1
EPSS 1.1%
PoC
- Published
- Updated
- Exploit status
- Proof-of-concept only
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.
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| ruby erb | = < 4.0.3.1 | No fix listed |
| ruby erb | = = 4.0.4 | No fix listed |
| ruby erb | = >= 5.0.0, < 6.0.1.1 | No fix listed |
| ruby erb | = >= 6.0.2, < 6.0.4 | No fix listed |
| redhat enterprise linux | < 0:3.3.10-12.el10_1 | 0:3.3.10-12.el10_1 |
| redhat enterprise linux | < 0:4.0.3-34.el10_2 | 0:4.0.3-34.el10_2 |
| redhat enterprise linux eus | < 0:3.3.10-11.el10_0.1 | 0:3.3.10-11.el10_0.1 |
| redhat enterprise linux | < 8100020260428163940.489197e6 | 8100020260428163940.489197e6 |
| redhat enterprise linux | < 9070020260428163621.9 | 9070020260428163621.9 |
| redhat enterprise linux | < 0:3.0.7-166.el9_7 | 0:3.0.7-166.el9_7 |
| redhat enterprise linux | < 9080020260513131334.9 | 9080020260513131334.9 |
| redhat rhel e4s | < 0:3.0.4-160.2.el9_0 | 0:3.0.4-160.2.el9_0 |
| redhat rhel e4s | < 0:3.0.4-161.el9_2.3 | 0:3.0.4-161.el9_2.3 |
| redhat rhel e4s | < 0:3.0.7-162.el9_4.2 | 0:3.0.7-162.el9_4.2 |
| redhat rhel e4s | < 9040020260520083544.9 | 9040020260520083544.9 |
| redhat rhel eus | < 0:3.0.7-165.el9_6.1 | 0:3.0.7-165.el9_6.1 |
| redhat rhel eus | < 9060020260630075016.9 | 9060020260630075016.9 |
| redhat enterprise linux | = 6 | No fix listed |
| redhat enterprise linux | = 7 | No fix listed |
| redhat enterprise linux | = 8 | No fix listed |
| redhat hummingbird | = 1 | No fix listed |
| redhat openshift | = 4 | No fix listed |
| debian/ruby3.1(Debian:12) | All versions | No fix listed |
| debian/ruby3.3(Debian:14) | All versions | No fix listed |
| debian/ruby3.3(Debian:13) | < 3.3.13-0+deb13u1 | 3.3.13-0+deb13u1 |
Show 60 more
| Product | Affected versions | Fixed in |
|---|---|---|
| debian/ruby3.1(Debian:12) | = 3.1.2-7 | No fix listed |
| debian/ruby3.1(Debian:12) | = 3.1.2-7+deb12u1 | No fix listed |
| debian/ruby3.1(Debian:12) | = 3.1.2-7+hurd.1 | No fix listed |
| debian/ruby3.1(Debian:12) | = 3.1.2-8 | No fix listed |
| debian/ruby3.1(Debian:12) | = 3.1.2-8.1~exp1 | No fix listed |
| debian/ruby3.1(Debian:12) | = 3.1.2-8.3 | No fix listed |
| debian/ruby3.1(Debian:12) | = 3.1.2-8.4 | No fix listed |
| debian/ruby3.1(Debian:12) | = 3.1.2-8.5 | No fix listed |
| debian/ruby3.3(Debian:13) | = 3.3.8-2 | No fix listed |
| debian/ruby3.3(Debian:13) | = 3.3.8-2.1 | No fix listed |
| debian/ruby3.3(Debian:13) | = 3.3.8-2.2 | No fix listed |
| debian/ruby3.3(Debian:14) | = 3.3.8-2 | No fix listed |
| debian/ruby3.3(Debian:14) | = 3.3.8-2.1 | No fix listed |
| debian/ruby3.3(Debian:14) | = 3.3.8-2.2 | No fix listed |
| redhat/ruby(Red Hat:enterprise_linux:10.1) | < 3.3.10-12.el10_1 | 3.3.10-12.el10_1 |
| redhat/ruby4.0(Red Hat:enterprise_linux:10.2) | < 4.0.3-34.el10_2 | 4.0.3-34.el10_2 |
| redhat/ruby(Red Hat:enterprise_linux_eus:10.0) | < 3.3.10-11.el10_0.1 | 3.3.10-11.el10_0.1 |
| redhat/ruby:3.3-8100020260428163940.489197e6(Red Hat:enterprise_linux:8) | All versions | No fix listed |
| redhat/ruby:3.3-9070020260428163621.9(Red Hat:enterprise_linux:9) | All versions | No fix listed |
| redhat/ruby(Red Hat:enterprise_linux:9) | < 3.0.7-166.el9_7 | 3.0.7-166.el9_7 |
| redhat/ruby:4.0-9080020260513131334.9(Red Hat:enterprise_linux:9) | All versions | No fix listed |
| redhat/ruby(Red Hat:rhel_e4s:9.0) | < 3.0.4-160.2.el9_0 | 3.0.4-160.2.el9_0 |
| redhat/ruby(Red Hat:rhel_e4s:9.2) | < 3.0.4-161.el9_2.3 | 3.0.4-161.el9_2.3 |
| redhat/ruby(Red Hat:rhel_e4s:9.4) | < 3.0.7-162.el9_4.2 | 3.0.7-162.el9_4.2 |
| redhat/ruby:3.3-9040020260520083544.9(Red Hat:rhel_e4s:9.4) | All versions | No fix listed |
| redhat/ruby(Red Hat:rhel_eus:9.6) | < 3.0.7-165.el9_6.1 | 3.0.7-165.el9_6.1 |
| redhat/ruby:3.3-9060020260630075016.9(Red Hat:rhel_eus:9.6) | All versions | No fix listed |
| ubuntu/ruby3.0(Ubuntu:22.04) | All versions | No fix listed |
| alpine/ruby(Alpine:v3.21) | < 3.3.13-r0 | 3.3.13-r0 |
| ubuntu/ruby3.2(Ubuntu:24.04) | All versions | No fix listed |
| ubuntu/jruby(Ubuntu:26.04) | All versions | No fix listed |
| ubuntu/ruby3.3(Ubuntu:26.04) | All versions | No fix listed |
| ubuntu/jruby(Ubuntu:26.10) | All versions | No fix listed |
| ubuntu/ruby3.3(Ubuntu:26.10) | All versions | No fix listed |
| rubygems erb(RubyGems) | < 4.0.3.1 | 4.0.3.1 |
| rubygems erb(RubyGems) | = 4.0.4 | No fix listed |
| rubygems erb(RubyGems) | >= 5.0.0, < 6.0.1.1 | 6.0.1.1 |
| rubygems erb(RubyGems) | >= 6.0.2, < 6.0.4 | 6.0.4 |
| rubygems erb(RubyGems) | = 2.2.0 | No fix listed |
| rubygems erb(RubyGems) | = 2.2.1 | No fix listed |
| rubygems erb(RubyGems) | = 2.2.2 | No fix listed |
| rubygems erb(RubyGems) | = 2.2.3 | No fix listed |
| rubygems erb(RubyGems) | = 3.0.0 | No fix listed |
| rubygems erb(RubyGems) | = 4.0.0 | No fix listed |
| rubygems erb(RubyGems) | = 4.0.1 | No fix listed |
| rubygems erb(RubyGems) | = 4.0.2 | No fix listed |
| rubygems erb(RubyGems) | = 4.0.3 | No fix listed |
| rubygems erb(RubyGems) | >= 4.0.4, < 4.0.4.1 | 4.0.4.1 |
| rubygems erb(RubyGems) | = 5.0.0 | No fix listed |
| rubygems erb(RubyGems) | = 5.0.1 | No fix listed |
| rubygems erb(RubyGems) | = 5.0.2 | No fix listed |
| rubygems erb(RubyGems) | = 5.0.3 | No fix listed |
| rubygems erb(RubyGems) | = 5.1.0 | No fix listed |
| rubygems erb(RubyGems) | = 5.1.1 | No fix listed |
| rubygems erb(RubyGems) | = 5.1.2 | No fix listed |
| rubygems erb(RubyGems) | = 5.1.3 | No fix listed |
| rubygems erb(RubyGems) | = 6.0.0 | No fix listed |
| rubygems erb(RubyGems) | = 6.0.1 | No fix listed |
| rubygems erb(RubyGems) | = 6.0.2 | No fix listed |
| rubygems erb(RubyGems) | = 6.0.3 | No fix listed |
References
- https://github.com/ruby/erb/security/advisories/GHSA-q339-8rmv-2mhv vendor-advisory
- Red Hat CVE page vdb-entry vendor-advisory
- RHBZ#2461369 issue-tracking
- security.access.redhat.com
- RHSA-2026:33478 patch vendor-advisory
- RHSA-2026:18065 patch vendor-advisory
- RHSA-2026:20606 patch vendor-advisory
- RHSA-2026:20614 patch vendor-advisory
- RHSA-2026:20670 patch vendor-advisory
- RHSA-2026:35834 patch vendor-advisory
- RHSA-2026:26312 patch vendor-advisory
- RHSA-2026:26655 patch vendor-advisory
- RHSA-2026:33462 patch vendor-advisory
- RHSA-2026:37238 patch vendor-advisory
- RHSA-2026:18039 patch vendor-advisory
- RHSA-2026:18030 patch vendor-advisory
- RHSA-2026:20596 patch vendor-advisory
- Debian Security Tracker CVE-2026-41316 vendor-advisory
- bugs.debian.org issue-tracking
- nvd.nist.gov third-party-advisory vendor-advisory
- github.com product
- github.com exploit
- github.com
- www.cve.org
- Ubuntu CVE tracker vendor-advisory
- security.alpinelinux.org vendor-advisory
- github.com patch
- github.com patch
- github.com patch
- github.com patch
- www.ruby-lang.org