CWE-693Weakness · CWE-693

CVE-2026-41316

HIGH · 8.1 CVSS v3.1 Published 2026-04-24
Mitigation only
No fix yet — a mitigation exists. There is no fixed release. A documented workaround reduces exposure in the meantime.
See remediation →
90/100
Remediation priority · Urgent
Remotely reachable No privileges Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
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.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

ERB's Ruby 2.7.0 update added an @_init instance variable guard to prevent code execution during Marshal.load deserialization, but this protection was only applied to ERB#result and ERB#run methods. Three other public methods (def_method, def_module, and def_class) that also evaluate @src via eval() were missed, allowing an attacker to use ERB#def_module as a code execution sink that completely bypasses the @_init protection when untrusted data is deserialized.

MitigationUpgrade ERB to version 4.0.3.1, 4.0.4.1, 6.0.1.1, 6.0.4 or later to receive the patch. Additionally, avoid deserializing untrusted data with Marshal.load when the erb library is loaded.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
High
Privileges
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

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Check Ruby version
    Run `ruby --version` to determine the installed Ruby version. The @_init protection was introduced in Ruby 2.7.0, so versions 2.7.0 and later contain the partial protection that can be bypassed.
    Affected if Ruby version is 2.7.0 or later AND the application uses ERB with the vulnerable methods
  2. Verify ERB library is loaded
    Search codebase for `require 'erb'` or `require 'erb'` statements, or check Gemfile for erb dependency.
    Affected if ERB library is loaded in the application
  3. Identify use of vulnerable ERB methods
    Search source code for calls to `ERB.new(...).def_method`, `ERB.new(...).def_module`, or `ERB.new(...).def_class`. These methods evaluate ERB templates via eval() without the @_init guard.
    Affected if Codebase contains any calls to def_method, def_module, or def_class on ERB objects
  4. Identify Marshal.load usage on untrusted data
    Search for `Marshal.load` calls in the codebase, particularly those that process data from external sources (user input, network, files from untrusted sources).
    Affected if Marshal.load is used to deserialize data that originates from untrusted sources
  5. Check for deserialization gadgets in loaded objects
    If ERB is loaded and Marshal.load is used, audit what classes are autoloaded or defined that could be leveraged during deserialization to trigger the vulnerable code path.
    Affected if Classes loaded in the application can be manipulated during Marshal.load to reach ERB vulnerability

You are affected if your Ruby version is 2.7.0 or later, your application loads the ERB library, uses ERB#def_method/def_module/def_class, and deserializes untrusted data with Marshal.load.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Mitigation available No clean upgrade yet — mitigate in the meantime
Mitigation

Upgrade ERB to version 4.0.3.1, 4.0.4.1, 6.0.1.1, 6.0.4 or later to receive the patch. Additionally, avoid deserializing untrusted data with Marshal.load when the erb library is loaded.

Recommended fix High confidence

ERB 4.0.4.1 (for 4.x) or ERB 6.0.4 (for 6.x)

  1. Identify the current ERB gem version in your Ruby application using `gem list erb` or `bundle exec gem list erb`
  2. Upgrade ERB to a patched version by running `gem install erb` or updating your Gemfile with `gem 'erb', '>= 4.0.4.1'` (for 4.x) or `gem 'erb', '>= 6.0.4'` (for 6.x)
  3. Run `bundle install` or `bundle update erb` to apply the change
  4. Verify the installed ERB version with `ruby -r erb -e 'puts ERB::VERSION'` to confirm it matches 4.0.3.1, 4.0.4.1, 6.0.1.1, or 6.0.4 or higher
  5. If using a framework (Rails, Sinatra), ensure the new ERB version is compatible with your application's dependencies

Generated from the published advisory — verify against the referenced sources before acting.

Have this fixed Scoped from the published advisory
  • Consultation2.0 h
  • Implementation1.0 h
  • Testing3.0 h
  • Review / QA1.0 h
7.0 hours of engineering $1,210
Get help mitigating

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $1,936.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2026-41316 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2026-41316 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data