Skip to content
Heist/ feed
Back to feed
HighFix available

ruby — security advisory

Type: advisorySources: OSVAdvisory ID: ALPINE-CVE-2026-41316

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.

Products
ruby
Affected versions
Not specified
Fixed versions
3.3.13-r0
CVEs
CVE-2026-41316
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 17:56 UTC · Revision 1

Source evidence

ALPINE-CVE-2026-41316

core-osv · Original source

Published 24 Apr 2026, 03:16 UTC

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.

osv:ALPINE-CVE-2026-41316

ruby

Fixed versions: 3.3.13-r0

Complete source record
{
  "id": "a431771610444c0a2f7ee6d6a7c0cac87eff33f7df8751c565ad534f9eb0a58f",
  "url": "https://osv.dev/vulnerability/ALPINE-CVE-2026-41316",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "ALPINE-CVE-2026-41316",
    "summary": "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.",
    "evidence": "osv:ALPINE-CVE-2026-41316",
    "products": [
      {
        "name": {
          "value": "ruby",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "3.3.13-r0",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "high",
    "structured": {
      "id": "ALPINE-CVE-2026-41316",
      "aliases": [
        "ALPINE-CVE-2026-41316"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "3.3.13-r0"
                }
              ]
            }
          ],
          "package": {
            "name": "ruby",
            "purl": "pkg:apk/alpine/ruby?arch=source",
            "ecosystem": "Alpine:v3.21"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/alpine/ALPINE-CVE-2026-41316.json"
          },
          "ecosystem_specific": {}
        }
      ],
      "modified": "2026-10-27T12:30:04.031955838Z",
      "provider": "osv",
      "upstream": [
        "CVE-2026-41316"
      ],
      "references": [
        "https://security.alpinelinux.org/vuln/CVE-2026-41316"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2026-41316",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 461533,
  "published_at": "2026-04-24T03:16:11.897+00:00"
}