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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
Primary rating from Vendor (https://github.com/davidfstr/rdiscount).
CVSS VectorVendor: https://github.com/davidfstr/rdiscount
Lifecycle Timeline
2DescriptionCVE.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:97ext/rdiscount.c:136
RSTRING_LEN(text) is passed directly into mkd_string():
MMIOT *doc = mkd_string(RSTRING_PTR(text), RSTRING_LEN(text), flags);mkd_string() accepts int len:
ext/mkdio.c:174
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
struct string_stream {
const char *data;
int size;
};The read loop stops only when size == 0:
ext/mkdio.c:161
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_htmlRDiscount.new(input).toc_content
PoC
Crash via to_html:
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:97ext/rdiscount.c:136
ex:
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
EUVD-2026-19474
GHSA-6r34-94wq-jhrc
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB