Skip to main content

EUVDEUVD-2026-19474

| CVE-2026-35201 MEDIUM
Out-of-bounds Read (CWE-125)
2026-04-06 https://github.com/davidfstr/rdiscount GHSA-6r34-94wq-jhrc
5.9
CVSS 3.1 · Vendor: https://github.com/davidfstr/rdiscount
View

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, read limits
MITRE ATT&CK

1 technique across 1 tactic: Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Impact

The CVSS score of 5.9 (medium severity) with vector AV:N/AC:H/PR:N/UI:N reflects the real-world constraints limiting this vulnerability's impact. The remote attack vector and lack of authentication requirement are concerning, but the high attack complexity (AC:H) reflects that exploitation requires deliberately crafted multi-gigabyte inputs, which is impractical in most web scenarios due to memory, bandwidth, and timeout constraints. The availability impact (A:H) is confirmed by the proof-of-concept triggering segmentation faults. Critically, this is NOT actively exploited (no KEV status), and the proof-of-concept requires explicit construction of 2.2GB strings-a level of attacker control and system resources rarely available in real deployments. The vulnerability is realistically limited to services that parse untrusted Markdown without input size limits and have sufficient memory to allocate multi-GB buffers. For typical web applications with request size limits (usually 1-100MB), this poses minimal risk. However, any service accepting unbounded user-supplied Markdown (file conversion tools, documentation platforms) should prioritize patching.

Exploit ScenarioDerived

An attacker uploads or submits a crafted 2.2GB+ Markdown document to a web service that converts user-supplied Markdown using RDiscount (e.g., a documentation platform, note-taking application, or file converter). The application attempts to parse the input via RDiscount.new(input).to_html without enforcing input size limits. The out-of-bounds read occurs when the parser's internal size counter wraps from positive to negative, causing it to read beyond the allocated buffer. This triggers a segmentation fault, crashing the worker process and achieving denial-of-service. No elevated privileges or authentication bypass is required; the attack is purely a memory crash via malformed input. While the proof-of-concept exists, real-world exploitation is constrained by the need to transmit or allocate multi-gigabyte payloads and the presence of typical HTTP request limits in production environments.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Apr 06, 2026

Out-of-bounds read in RDiscount's Markdown parser allows denial-of-service when processing attacker-controlled inputs exceeding 2GB. The vulnerability occurs because unsigned Ruby string lengths are truncated to signed integers before passing to the native parser, causing the parser to read past buffer boundaries and crash. Affected are RDiscount.new(input).to_html and RDiscount.new(input).toc_content methods. No public exploitation beyond proof-of-concept exists; patch version 2.2.7.4 is available.

RemediationAI

Upgrade RDiscount to version 2.2.7.4 or later, which includes a length validation guard in both mkd_string() call sites (ext/rdiscount.c lines 97 and 136). The patch explicitly checks if text_len exceeds INT_MAX before type conversion and raises ArgumentError with message 'markdown input too large' if the threshold is exceeded. For gems, update via bundle update rdiscount or gem install rdiscount -v '2.2.7.4'. Until patching is possible, implement input size limits at the application level by rejecting Markdown inputs exceeding a reasonable threshold (e.g., 100MB) before passing to RDiscount. The patch and advisory are available at https://github.com/davidfstr/rdiscount/commit/b1a16445e92e0d12c07594dedcdc56f80b317761 and https://github.com/advisories/GHSA-6r34-94wq-jhrc.

Affected VersionsENISA

rdiscount 1.3.1.1, < 2.2.7.4

Affected Packages

rubygems rdiscount fix: 2.2.7.4

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in rubygems

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

RDiscount is a Ruby gem wrapping the discount C Markdown parser. The vulnerability stems from a signed/unsigned integer mismatch in the C extension layer. Ruby's RSTRING_LEN() macro returns a C long (unsigned on 64-bit systems), but both public entry points in ext/rdiscount.c pass this directly to mkd_string() which accepts a signed int parameter. The discount parser stores the input length in struct string_stream as a signed int and decrements it in a loop until reaching zero. When a Ruby string exceeds INT_MAX (2^31-1 bytes, approximately 2.1GB), the truncation causes the size field to become negative. Since the loop condition checks only for zero, a negative size never terminates, causing __mkd_io_strget() to continue reading from data pointer beyond the allocated buffer boundary. The root cause is CWE-125 (out-of-bounds read) combined with integer truncation logic that fails to validate input ranges before type conversion.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/davidfstr/rdiscount) PRIMARY 5.9 MEDIUM
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
SUSE MEDIUM

Primary rating from Vendor (https://github.com/davidfstr/rdiscount).

CVSS VectorVendor: https://github.com/davidfstr/rdiscount

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Lifecycle Timeline

2
Patch released
Apr 06, 2026 - 19:00 nvd
Patch available
CVE Published
Apr 06, 2026 - 17:53 nvd
MEDIUM 5.9

DescriptionCVE.org

Summary

A signed length truncation bug causes an out-of-bounds read in the default Markdown parse path. Inputs larger than INT_MAX are truncated to a signed int before entering the native parser, allowing the parser to read past the end of the supplied buffer and crash the process

Details

In both public entry points:

  • ext/rdiscount.c:97
  • ext/rdiscount.c:136

RSTRING_LEN(text) is passed directly into mkd_string():

c
MMIOT *doc = mkd_string(RSTRING_PTR(text), RSTRING_LEN(text), flags);

mkd_string() accepts int len:

  • ext/mkdio.c:174
c
Document * mkd_string(const char *buf, int len, mkd_flag_t flags)
{
    struct string_stream about;

    about.data = buf;
    about.size = len;

    return populate((getc_func)__mkd_io_strget, &about, flags & INPUT_MASK);
}

The parser stores the remaining input length in a signed int:

  • ext/markdown.h:205
c
struct string_stream {
    const char *data;
    int   size;
};

The read loop stops only when size == 0:

  • ext/mkdio.c:161
c
int __mkd_io_strget(struct string_stream *in)
{
    if ( !in->size ) return EOF;

    --(in->size);

    return *(in->data)++;
}

If the Ruby string length exceeds INT_MAX, the value can truncate to a negative int. In that state, the parser continues incrementing data and reading past the end of the original Ruby string, causing an out-of-bounds read and native crash.

Affected APIs:

  • RDiscount.new(input).to_html
  • RDiscount.new(input).toc_content

PoC

Crash via to_html:

sh
RUBYLIB=lib:ext ruby -e 'require "rdiscount"; n=2_200_000_000; s = "a" * n; warn "built=#{s.bytesize}"; RDiscount.new(s).to_html"'

result:

  • built=2200000000
  • Ruby terminates with [BUG] Segmentation fault
  • top control frame: CFUNC :to_html

same result with toc_content

Impact

This is an out-of-bounds read with the main issue being reliable denial-of-service. Impacted is limited to deployments parses attacker-controlled Markdown and permits multi-GB inputs.

Fix

just add a checked length guard before the mkd_string() call in both public entry points:

  • ext/rdiscount.c:97
  • ext/rdiscount.c:136

ex:

c
VALUE text = rb_funcall(self, rb_intern("text"), 0);
long text_len = RSTRING_LEN(text);
VALUE buf = rb_str_buf_new(1024);
Check_Type(text, T_STRING);

if (text_len > INT_MAX) {
    rb_raise(rb_eArgError, "markdown input too large");
}

MMIOT *doc = mkd_string(RSTRING_PTR(text), (int)text_len, flags);

The same guard should be applied in rb_rdiscount_toc_content() before its mkd_string() call.

Threat Intelligence Overview

EPSS Score
0.0%
Top 88% exploitable
Threat Intel
1
1 source
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Vendor StatusVendor

SUSE

Severity: Medium

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy