Ruby through 2.2.7, 2.3.x through 2.3.4, and 2.4.x through 2.4.1 can expose arbitrary memory during a JSON.generate call.
Ruby through 2.2.7, 2.3.x through 2.3.4, and 2.4.x through 2.4.1 can expose arbitrary memory during a JSON.generate call. The issues lies in using strdup in ext/json/ext/generator/generator.c, which will stop after encountering a '\0' byte, returning a pointer to a string of length zero, which is not the length stored in space_len.
- Published
- Aug 31, 2017
- Updated
- Jun 16, 2026
- EPSS
- 9.4% · 95th percentile
- CWE
- CWE-119
Sign in to follow · You’ll be notified if a followed record enters KEV, gets an exploit or is updated.
Report tools
Action score
42
Plan
Add it to your regular patch cycle.
- CVSS
- 39 / 40 · 9.8 / 10
- CISA KEV
- 0 / 30 · Not listed
- EPSS
- 3 / 30 · 9.4%
Affected systems
| Vendor | Product | CPE |
|---|---|---|
| ruby-lang | ruby | cpe:2.3:a:ruby-lang:ruby |
| debian | debian linux | cpe:2.3:o:debian:debian_linux |
| canonical | ubuntu linux | cpe:2.3:o:canonical:ubuntu_linux |
| redhat | enterprise linux desktop | cpe:2.3:o:redhat:enterprise_linux_desktop |
| redhat | enterprise linux server | cpe:2.3:o:redhat:enterprise_linux_server |
| redhat | enterprise linux server aus | cpe:2.3:o:redhat:enterprise_linux_server_aus |
| redhat | enterprise linux server eus | cpe:2.3:o:redhat:enterprise_linux_server_eus |
| redhat | enterprise linux server tus | cpe:2.3:o:redhat:enterprise_linux_server_tus |
| redhat | enterprise linux workstation | cpe:2.3:o:redhat:enterprise_linux_workstation |
Affected versions
NVD version ranges (for catalog products). Add the product to your stack with a version and matching uses these.
- canonical ubuntu linux14.04
- canonical ubuntu linux16.04
- canonical ubuntu linux17.10
- debian debian linux8.0
- debian debian linux9.0
- redhat enterprise linux desktop7.0
- redhat enterprise linux server7.0
- redhat enterprise linux server aus7.4
- redhat enterprise linux server aus7.6
- redhat enterprise linux server eus7.4
- redhat enterprise linux server eus7.5
- redhat enterprise linux server eus7.6
- redhat enterprise linux server tus7.4
- redhat enterprise linux server tus7.6
- redhat enterprise linux workstation7.0
- ruby-lang rubyup to 2.2.7 inclusive
- ruby-lang ruby2.3.0
- ruby-lang ruby2.3.1
- ruby-lang ruby2.3.2
- ruby-lang ruby2.3.3
Package-level exposure
OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.
| Ecosystem | Package | Affected range | Fix |
|---|---|---|---|
| Alpine:v3.10 | ruby | before 2.4.2-r0 | 2.4.2-r0 |
| Alpine:v3.3 | ruby | before 2.2.8-r0 | 2.2.8-r0 |
| Alpine:v3.4 | ruby | before 2.3.5-r0 | 2.3.5-r0 |
| Debian:7 | ruby1.9.1 | before 1.9.3.194-8.1+deb7u6 | 1.9.3.194-8.1+deb7u6 |
| Debian:8 | ruby2.1 | before 2.1.5-2+deb8u4 | 2.1.5-2+deb8u4 |
| Debian:9 | ruby2.3 | before 2.3.3-1+deb9u1 | 2.3.3-1+deb9u1 |
| Red Hat:enterprise_linux:7::client | ruby | before 0:2.0.0.648-33.el7_4 | 0:2.0.0.648-33.el7_4 |
| Red Hat:enterprise_linux:7::client | ruby-debuginfo | before 0:2.0.0.648-33.el7_4 | 0:2.0.0.648-33.el7_4 |
| Red Hat:enterprise_linux:7::client | ruby-devel | before 0:2.0.0.648-33.el7_4 | 0:2.0.0.648-33.el7_4 |
| Red Hat:enterprise_linux:7::client | ruby-doc | before 0:2.0.0.648-33.el7_4 | 0:2.0.0.648-33.el7_4 |
| Red Hat:enterprise_linux:7::client | ruby-irb | before 0:2.0.0.648-33.el7_4 | 0:2.0.0.648-33.el7_4 |
| Red Hat:enterprise_linux:7::client | ruby-libs | before 0:2.0.0.648-33.el7_4 | 0:2.0.0.648-33.el7_4 |
| Red Hat:enterprise_linux:7::client | ruby-tcltk | before 0:2.0.0.648-33.el7_4 | 0:2.0.0.648-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygem-bigdecimal | before 0:1.2.0-33.el7_4 | 0:1.2.0-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygem-io-console | before 0:0.4.2-33.el7_4 | 0:0.4.2-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygem-json | before 0:1.7.7-33.el7_4 | 0:1.7.7-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygem-minitest | before 0:4.3.2-33.el7_4 | 0:4.3.2-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygem-psych | before 0:2.0.0-33.el7_4 | 0:2.0.0-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygem-rake | before 0:0.9.6-33.el7_4 | 0:0.9.6-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygem-rdoc | before 0:4.0.0-33.el7_4 | 0:4.0.0-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygems | before 0:2.0.14.1-33.el7_4 | 0:2.0.14.1-33.el7_4 |
| Red Hat:enterprise_linux:7::client | rubygems-devel | before 0:2.0.14.1-33.el7_4 | 0:2.0.14.1-33.el7_4 |
| Red Hat:rhel_software_collections:3::el6 | rh-ruby22-ruby | before 0:2.2.9-19.el6 | 0:2.2.9-19.el6 |
| Red Hat:rhel_software_collections:3::el6 | rh-ruby22-ruby-debuginfo | before 0:2.2.9-19.el6 | 0:2.2.9-19.el6 |
+96
Same product
ruby-lang: all recordsOther highest-scoring records for the same primary product.
- CVE-2017-17405Ruby before 2.4.3 allows Net::FTP command injection.57Plan
- CVE-2008-3656Algorithmic complexity vulnerability in the WEBrick::HTTPUtils.split_header_value function in WEBrick::HTTP::DefaultFileHandler in WEBrick i52Plan
- CVE-2021-28966In Ruby through 3.0 on Windows, a remote attacker can submit a crafted path when a Web application handles a parameter with TmpDir.47Plan
- CVE-2017-17790The lazy_initialize function in lib/resolv.rb in Ruby through 2.4.3 uses Kernel#open, which might allow Command Injection attacks, as demons41Plan
- CVE-2016-2339An exploitable heap overflow vulnerability exists in the Fiddle::Function.new "initialize" function functionality of Ruby.41Plan
- CVE-2016-2337Type confusion exists in _cancel_eval Ruby's TclTkIp class method.41Plan
Remediation
Which version to upgrade to
Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.
| Product / package | Fixed version | Source |
|---|---|---|
| alpine:ruby | 2.4.2-r0 · Alpine:v3.10 | Package registry (OSV) |
| debian:ruby1.9.1 | 1.9.3.194-8.1+deb7u6 · Debian:7 | Package registry (OSV) |
| debian:ruby2.1 | 2.1.5-2+deb8u4 · Debian:8 | Package registry (OSV) |
| debian:ruby2.3 | 2.3.3-1+deb9u1 · Debian:9 | Package registry (OSV) |
| red hat:rh-ruby24-ruby | 0:2.4.2-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-ruby-debuginfo | 0:2.4.2-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-ruby-devel | 0:2.4.2-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-ruby-doc | 0:2.4.2-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-ruby-irb | 0:2.4.2-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-ruby-libs | 0:2.4.2-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-rubygem-bigdecimal | 0:1.3.0-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-rubygem-did_you_mean | 0:1.1.0-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-rubygem-io-console | 0:0.4.6-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-rubygem-json | 0:2.0.4-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-rubygem-minitest | 0:5.10.1-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| red hat:rh-ruby24-rubygem-net-telnet | 0:0.1.1-86.el6 · Red Hat:rhel_software_collections:3::el6 | Package registry (OSV) |
| suse:ruby2.1 | 2.1.9-19.3.2 · SUSE:HPE Helion OpenStack 8 | Package registry (OSV) |
| suse:yast2-ruby-bindings | 3.1.53-9.8.1 · SUSE:OpenStack Cloud 7 | Package registry (OSV) |
Exploit status
No known public exploit
No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.
Research context
For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.
Timeline
From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.
No dated events beyond publication.
FIRST EPSS daily score; only changes of 0.01 or more are recorded (step chart).
Patch and commit links
Commit, PR and diff links among the references. A starting point for patch-diffing and variant hunting; fixes, not exploits.
Credits
All researchersFinders, reporters and analysts named in the CNA record. Click a name for that researcher’s other records.
No credits in the CNA record.
Variant candidates
Same product, same weakness class, within 18 months. If the patch missed the root cause, the sibling bug is here.
No nightly-computed relations.
Chain candidates
An authentication bypass and a privilege-requiring bug in the same product, published close together: combined they may become an unauthenticated path.
—
Bug bounty scope
The product’s vendor appears in a public program. Matched by name; verify the scope text in the program.
Technical details
Attack conditions
- Anyone who can reach it over the internet can trigger it.
- No account or password is required.
- No user action is required.
- No special conditions are required; it is repeatable.
If successful
- Confidentiality
- high · data can be read
- Integrity
- high · data or configuration can be modified
- Availability
- high · the service can be disrupted
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality impact
- High
- Integrity impact
- High
- Availability impact
- High
Weakness class (CWE)
CWE-119 · Improper Restriction of Operations within the Bounds of a Memory BufferCVSS vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
nvd-primary
Attack context
MITRE CAPEC attack patterns and ATT&CK techniques for this weakness class (CWE). A starting point for detection rules and threat hunting.
Attack patterns (CAPEC)
- Buffer Overflow via Environment VariablesCAPEC-10likelihood: High · High
- Overflow BuffersCAPEC-100likelihood: High · Very High
- Buffer ManipulationCAPEC-123likelihood: High · Very High
- Client-side Injection-induced Buffer OverflowCAPEC-14likelihood: Medium · High
- Filter Failure through Buffer OverflowCAPEC-24likelihood: High · High
- MIME ConversionCAPEC-42likelihood: High · High
- Overflow Binary Resource FileCAPEC-44likelihood: High · Very High
- Buffer Overflow via Symbolic LinksCAPEC-45likelihood: High · High
ATT&CK techniques
—
Noroxi analysis
No Noroxi analysis for this record yet
We don't hand-write analysis for all 385,000+ vulnerabilities; that wouldn't be honest. For notable, high-impact vulnerabilities our team writes the mechanism, detection and remediation steps.
We use this product, ask for helpChange log
- Fix✗ → ✓
For records you follow, these changes also arrive as notifications. →
References
- github.com/flori/json/commit/8f782fd8e181d9cfe9387ded43a5ca9692266b85
- www.securityfocus.com/bid/100890
- www.securitytracker.com/id/1039363
- www.securitytracker.com/id/1042004
- access.redhat.com/errata/RHSA-2017:3485
- access.redhat.com/errata/RHSA-2018:0378
- access.redhat.com/errata/RHSA-2018:0583
- access.redhat.com/errata/RHSA-2018:0585
- bugs.ruby-lang.org/issues/13853
- lists.debian.org/debian-lts-announce/2018/07/msg00012.html
- security.gentoo.org/glsa/201710-18
- usn.ubuntu.com/3685-1/
- www.debian.org/security/2017/dsa-3966
- www.ruby-lang.org/en/news/2017/09/14/ruby-2-2-8-released/
- www.ruby-lang.org/en/news/2017/09/14/ruby-2-3-5-released/
Vendor advisories and official records. Exploit/PoC links are deliberately left out.