Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…
EPSS 0.0%top 85%

CVE-2026-41316: CWE-693: Protection Mechanism Failure in ruby erb

0
High
VulnerabilityCVE-2026-41316cvecve-2026-41316cwe-693
Published: Fri Apr 24 2026 (04/24/2026, 02:35:41 UTC)
Source: CVE Database V5
Vendor/Project: ruby
Product: erb

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.

CVSS v3.1

Score 8.1high

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 05/01/2026, 20:39:02 UTC

Technical Analysis

Ruby's ERB templating system introduced an instance variable guard (@_init) in version 2.7.0 to prevent code execution during deserialization via Marshal.load. However, this guard was not applied to three public methods—ERB#def_method, ERB#def_module, and ERB#def_class—that also evaluate the source code (@src) using eval(). An attacker who can cause Marshal.load on untrusted data in an application with ERB loaded can exploit ERB#def_module with default parameters to bypass the @_init guard and execute arbitrary code. This vulnerability affects multiple ERB versions prior to 4.0.3.1 and certain later versions as specified. The issue is patched in ERB versions 4.0.3.1, 4.0.4.1, 6.0.1.1, and 6.0.4.

Potential Impact

Successful exploitation allows an attacker to execute arbitrary code remotely without privileges or user interaction, impacting confidentiality, integrity, and availability of the affected system. This can lead to full system compromise in applications that deserialize untrusted data using Marshal.load with vulnerable ERB versions.

Mitigation Recommendations

Patch to ERB versions 4.0.3.1, 4.0.4.1, 6.0.1.1, or 6.0.4 where the vulnerability is fixed. Since no vendor advisory or official patch links are provided, verify patch availability from the official Ruby or ERB project sources. Avoid deserializing untrusted data with Marshal.load as a general best practice. Patch status is not yet confirmed in the provided data; check the vendor advisory for current remediation guidance.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-04-20T14:01:46.671Z
Cvss Version
3.1
State
PUBLISHED
Remediation Level
null

Threat ID: 69eada9887115cfb68a5e99c

Added to database: 4/24/2026, 2:51:04 AM

Last enriched: 5/1/2026, 8:39:02 PM

Last updated: 6/7/2026, 10:36:43 AM

Views: 73

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses