ERB
ERB has an @_init deserialization guard bypass via def_module / def_method / def_class
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 versions and mitigation
From the CVE record and the vendor's references.Affected
- < 4.0.3.1
- = 4.0.4
- >= 5.0.0, < 6.0.1.1
- >= 6.0.2, < 6.0.4
Fixed in 4.0.3.1, 6.0.1.1, 6.0.4
Mitigation
Upgrade erb to 4.0.3.1 or 6.0.1.1 or 6.0.4 or later.
References
- Vendor advisory github.com/ruby/erb/security/advisories/GHSA-q…
Timeline
Days relative to CVE publicationFirst public PoC 172 days after publication; not in CISA KEV. First PoC: 5t1ck/rails-doubletap-py (created 13 Oct 2026, found by us: backfilled).
PoC repositories
Found on GitHub.1 PoCs · 1 suspicious or fake
PoCs 1
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| 5t1ck/rails-doubletap-py | 13 Oct 2026 +172 d | 0 | PoC via PoC Index |
Suspicious or fake 1
| Repository | Created | Found by us | Stars | Assessment |
|---|---|---|---|---|
| khushitaliyan23june/deserialization-gadget-lab | 31 Oct 2026 +191 d | 14 Nov 2026 | 0 | Fake |
Only PoCs count toward the first-PoC date and the characteristics below. "Backfilled" means we found the repository more than 30 days after it was created. Do not run PoC code from unknown sources.
PoC characteristics
What to hunt for in your logs · from 1 PoC repoGET /rails/active_storage/disk/{var}/x
- Ports
- 3000, 8080
- Seen in
- 1 repo: 5t1ck/rails-doubletap-py
- Evidence
- 5t1ck/rails-doubletap-py/doubletap.py:322
Regex
Generated from PoC characteristics; not yet reviewed. Matches the request path and query.
(?i)^/rails/active_storage/disk/[^/?#]*/x(?:[?#].*)?$
Suricata
Template generated from PoC characteristics. Review before deploying.
alert http any any -> $HOME_NET [3000,8080] (msg:"GG PoC-Monitor CVE-2026-41316 ruby erb exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/rails/active_storage/disk/"; reference:url,poc.griffinguard.io/cve/CVE-2026-41316; classtype:web-application-attack; sid:9795970; rev:1;)
Sigma
Template generated from PoC characteristics. Review before deploying.
title: ruby erb exploit attempt (CVE-2026-41316)
id: gg-pocmon-cve-2026-41316-9795970
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-41316. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2026-41316
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/rails/active_storage/disk/'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: high
tags:
- attack.initial_access
- attack.t1190
- cve.2026.41316