REDHAT-BUG-2461369: High severity rubygems/erb vulnerability
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#defmethod, ERB#defmodule, and ERB#defclass. An attacker who can trigger Marshal.load on untrusted data in a Ruby application that has erb loaded can use ERB#defmodule (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 Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Ruby ERBto a version that resolves this vulnerability.Patch ERB 4.0.3.1 - Compensating control
If an attacker can trigger `Marshal.load` on untrusted data in the Ruby application, prevent deserialization of attacker-controlled objects by ensuring `Marshal.load` is only used on trusted data (or by replacing it with a safe alternative), since ERB deserialization/Reconstruction is the precondition for the `@_init` bypass mentioned.
Event History
Frequently Asked Questions
What is the severity of REDHAT-BUG-2461369?
The severity of REDHAT-BUG-2461369 is classified as high with a rating of 7.
How do I fix REDHAT-BUG-2461369?
To fix REDHAT-BUG-2461369, upgrade to ERB version 2.2.0 or later.
What software is affected by REDHAT-BUG-2461369?
The software affected by REDHAT-BUG-2461369 is rubygems/erb.
What vulnerabilities are associated with REDHAT-BUG-2461369?
REDHAT-BUG-2461369 is associated with vulnerabilities related to code execution during ERB object reconstruction.
When was REDHAT-BUG-2461369 published?
REDHAT-BUG-2461369 was published on April 24, 2026.