Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2026-41316— ERB has an @_init deserialization guard bypass via def_module / def_method / def_class

Quick assessment

Affected
ruby erb
Exploitation
No confirmed in-the-wild exploitation; assess based on exposure
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

ERB是The Ruby Programming Language开源的一款嵌入式Ruby模板处理工具。 ERB存在安全漏洞,该漏洞源于ERB#def_method、ERB#def_module和ERB#def_module方法未对@src进行保护,可能导致攻击者通过Marshal.load触发反序列化时,使用ERB#def_module作为代码执行点,绕过@_init保护。以下版本受到影响:ERB 4.0.3.1之前版本、4.0.4.1之前版本、6.0.1.1之前版本和6.0.4之前版本。

CVSS 8.1 · High EPSS 1.31% · P70

Affected Version Matrix 4

VendorProduct Version RangeStatus
ruby erb < 4.0.3.1 affected
= 4.0.4 affected
>= 5.0.0, < 6.0.1.1 affected
>= 6.0.2, < 6.0.4 affected
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2026-41316

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
ERB has an @_init deserialization guard bypass via def_module / def_method / def_class
Source: CVE Program / CVE List V5
Vulnerability 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.
Source: CVE Program / CVE List V5
CVSS Information
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Source: CVE Program / CVE List V5
Vulnerability Type
保护机制失效
Source: CVE Program / CVE List V5
Vulnerability Title
ERB 安全漏洞
Source: CNNVD (China National Vulnerability Database)
Vulnerability Description
ERB是The Ruby Programming Language开源的一款嵌入式Ruby模板处理工具。 ERB存在安全漏洞,该漏洞源于ERB#def_method、ERB#def_module和ERB#def_module方法未对@src进行保护,可能导致攻击者通过Marshal.load触发反序列化时,使用ERB#def_module作为代码执行点,绕过@_init保护。以下版本受到影响:ERB 4.0.3.1之前版本、4.0.4.1之前版本、6.0.1.1之前版本和6.0.4之前版本。
Source: CNNVD (China National Vulnerability Database)
CVSS Information
N/A
Source: CNNVD (China National Vulnerability Database)
Vulnerability Type
N/A
Source: CNNVD (China National Vulnerability Database)

Affected Products

Vendor Product Affected Versions CPE Subscribe
ruby erb < 4.0.3.1 -

II. Public POCs for CVE-2026-41316

# POC Description Source Link Shenlong Link
AI-Generated POC Premium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2026-41316

请登录查看更多情报信息。

IV. Related Vulnerabilities

V. Comments for CVE-2026-41316

No comments yet


Leave a comment