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 1.1%top 37%

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

0
High
VulnerabilityCVE-2026-41316cvecve-2026-41316cwe-693
Published: 04/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

Affected software

erb
pkg:gem/erb
Affected versions
<4.0.3.1=4.0.4

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 07/16/2026, 09:00:08 UTC

Technical Analysis

CVE-2026-41316 is a protection mechanism failure in Ruby's ERB templating system. Ruby 2.7.0 introduced an instance variable guard (@_init) in ERB#result and ERB#run to prevent code execution when an ERB object is deserialized via Marshal.load. However, three other public methods—ERB#def_method, ERB#def_module, and ERB#def_class—that also evaluate the source code via eval() lacked this guard. An attacker able to trigger Marshal.load on untrusted data can exploit ERB#def_module to bypass the @_init guard and achieve arbitrary code execution. The vulnerability is addressed in ERB versions 4.0.3.1, 4.0.4.1, 6.0.1.1, and 6.0.4. Red Hat advisories provide patches for affected Red Hat Enterprise Linux versions.

Potential Impact

Successful exploitation allows an attacker to execute arbitrary code in the context of the Ruby application using ERB, leading to full confidentiality, integrity, and availability compromise. The CVSS v3.1 score is 8.1 (High), reflecting network attack vector, high impact on confidentiality, integrity, and availability, and requiring no privileges or user interaction but with high attack complexity.

Mitigation Recommendations

Fixes are available and have been released in ERB versions 4.0.3.1, 4.0.4.1, 6.0.1.1, and 6.0.4. Users should upgrade to these or later patched versions. Red Hat has issued security advisories and errata with updated packages for affected Red Hat Enterprise Linux versions. Applying these vendor-provided updates will remediate the vulnerability. Patch status is confirmed by vendor advisories linked in the references.

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
Vendor Advisory Urls
[{"url":"https://access.redhat.com/security/cve/CVE-2026-41316","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:18065","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:20606","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:20614","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:20670","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26312","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26655","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:18039","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:18030","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:20596","vendor":"Red Hat"}]

Threat ID: 69eada9887115cfb68a5e99c

Added to database: 04/24/2026, 02:51:04 UTC

Last enriched: 07/16/2026, 09:00:08 UTC

Last updated: 07/31/2026, 19:22:58 UTC

Views: 126

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