The extract_files function in installer.rb in RubyGems before 0.9.1 does not check whether files exist before overwriting them, which allows user-assisted remote attackers to overwrite arbitrary files, cause a denial of service, or execute arbitrary code via crafted GEM packages.
https://exchange.xforce.ibmcloud.com/vulnerabilities/31688
http://www.vupen.com/english/advisories/2007/0295
http://www.securityfocus.com/archive/1/458128/100/0/threaded
http://www.novell.com/linux/security/advisories/2007_4_sr.html