Description
An exploitable heap overflow vulnerability exists in the Psych::Emitter start_document function of Ruby. In Psych::Emitter start_document function heap buffer "head" allocation is made based on tags array length. Specially constructed object passed as element of tags array can increase this array size after mentioned allocation and cause heap overflow.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 8 | ruby2.1 | 2.1.5-2+deb8u9 | DLA-2158-1 |
Amazon Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Amazon Linux 2 | ruby +5 | 2.0.0.648-36.amzn2.0.17 | ALAS2-2025-2990 |
| Amazon Linux 2 | rubygem-bigdecimal | 1.2.0-36.amzn2.0.17 | ALAS2-2025-2990 |
| Amazon Linux 2 | rubygem-io-console | 0.4.2-36.amzn2.0.17 | ALAS2-2025-2990 |
| Amazon Linux 2 | rubygem-json | 1.7.7-36.amzn2.0.17 | ALAS2-2025-2990 |
| Amazon Linux 2 | rubygem-minitest | 4.3.2-36.amzn2.0.17 | ALAS2-2025-2990 |
| Amazon Linux 2 | rubygem-psych | 2.0.0-36.amzn2.0.17 | ALAS2-2025-2990 |
| Amazon Linux 2 | rubygem-rake | 0.9.6-36.amzn2.0.17 | ALAS2-2025-2990 |
| Amazon Linux 2 | rubygem-rdoc | 4.0.0-36.amzn2.0.17 | ALAS2-2025-2990 |
| Amazon Linux 2 | rubygems +1 | 2.0.14.1-36.amzn2.0.17 | ALAS2-2025-2990 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
GitHub 1 repository
-
SpiralBL0CK/CVE-2016-2338-nday ★ 0 · Dec 19, 2022
CVE-2016-2338 Use-after-free nday full exploit
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Advisories 2
- DLA-2158-1 ruby2.1 - security update Debian Security (DSA / DLA) · Mar 9, 2026
- ALAS2-2025-2990 Moderate: ruby security update (Amazon Linux 2) Amazon Linux Security Center (ALAS) · Sep 4, 2025