Skip to content

CVE-2019-8320 RubyGems Delete directory using symlink when decompressing tar

HighCVSS 7.4 EPSS 4.2% PoC
Published
Updated
Exploit status
Proof-of-concept only

Description

A Directory Traversal issue was discovered in RubyGems 2.7.6 and later through 3.0.2. Before making new directories or touching files (which now include path-checking code for symlinks), it would delete the target destination. If that destination was hidden behind a symlink, a malicious gem could delete arbitrary files on the user's machine, presuming the attacker could guess at paths. Given how frequently gem is run as sudo, and how predictable paths are on modern systems (/tmp, /usr, etc.), this could likely lead to data loss or an unusable system.

Affected products

ProductAffected versionsFixed in
rubygems-update(RubyGems) >= 2.7.6, < 2.7.9 2.7.9
rubygems-update(RubyGems) >= 3.0.0, < 3.0.3 3.0.3
rubygems-update(RubyGems) = 2.7.6 No fix listed
rubygems-update(RubyGems) = 2.7.7 No fix listed
rubygems-update(RubyGems) = 2.7.8 No fix listed
rubygems-update(RubyGems) = 3.0.0 No fix listed
rubygems-update(RubyGems) = 3.0.1 No fix listed
rubygems-update(RubyGems) = 3.0.2 No fix listed
debian/jruby(Debian:12) < 9.1.17.0-3 9.1.17.0-3
debian/jruby(Debian:13) < 9.1.17.0-3 9.1.17.0-3
debian/jruby(Debian:14) < 9.1.17.0-3 9.1.17.0-3
debian/rubygems(Debian:12) < 3.2.0~rc.1-1 3.2.0~rc.1-1
debian/rubygems(Debian:13) < 3.2.0~rc.1-1 3.2.0~rc.1-1
debian/rubygems(Debian:14) < 3.2.0~rc.1-1 3.2.0~rc.1-1
rubygems >= 2.7.6, <= 3.0.2 No fix listed
alpine/ruby(Alpine:v3.6) < 2.4.6-r0 2.4.6-r0
alpine/ruby(Alpine:v3.7) < 2.4.6-r0 2.4.6-r0
alpine/ruby(Alpine:v3.8) < 2.5.5-r0 2.5.5-r0
alpine/ruby(Alpine:v3.9) < 2.5.5-r0 2.5.5-r0

References