Description
Title: Remote Command Injection in Arabic Prawn 0.0.1 Ruby Gem
Author: Larry W. Cashdollar, @_larry0
Download Site: http://rubygems.org/gems/Arabic-Prawn
CVE: 2014-2322
Date: 12/17/2013
In Arabic-Prawn-0.0.1/lib/string_utf_support.rb, the following lines pass unsanitized input to the shell.
426 var = %x{ /usr/bin/curl -I -L --fail --silent --connect-timeout #{seconds} --max-time #{seconds+10} #{url}; /bin/echo -n $? }.to_i
427
428 #return false unless var == 0
429 raise "Failed to create connection to web site: #{url} -- curl error code: #{var} -- " unless var == 0
430
431 str = %x{ /usr/bin/curl -L --fail --silent --connect-timeout #{seconds} --max-time #{seconds+10} #{url} | \
432 /usr/bin/grep -Eo -m 1 \"(charset|encoding)=[\\"']?[^\\"'>]+\" | /usr/bin/grep -Eo \"[^=\\" '>]+$\" }
443 %x{ /usr/bin/touch #{downloaded_file} 2>/dev/null }
444 raise "No valid HTML download file (path) specified!" unless File.file?(downloaded_file)
445 %x{ /usr/bin/curl -L --fail --silent --connect-timeout #{seconds} --max-time #{seconds+10} -o #{downloaded_file} #{url} }
446
447 simple_test = %x{ /usr/bin/file -ik #{downloaded_file} } # cf. man file
If the downloaded file name #{downloaded_file} or #{url} contains any shell meta characters like ';' a malicious user can inject shell commands.
PoC
myfile;id;.txt
id would be passed to the command line and executed.
Advisory: http://www.vapid.dhs.org/advisories/arabic-ruby-gem.html
{"id": "SECURITYVULNS:DOC:30569", "bulletinFamily": "software", "title": "Remote Command Injection in Arabic Prawn 0.0.1 Ruby Gem", "description": "\r\n\r\nTitle: Remote Command Injection in Arabic Prawn 0.0.1 Ruby Gem\r\n\r\nAuthor: Larry W. Cashdollar, @_larry0\r\n\r\nDownload Site: http://rubygems.org/gems/Arabic-Prawn\r\n\r\nCVE: 2014-2322\r\nDate: 12/17/2013\r\n\r\nIn Arabic-Prawn-0.0.1/lib/string_utf_support.rb, the following lines pass unsanitized input to the shell.\r\n\r\n426 var = %x{ /usr/bin/curl -I -L --fail --silent --connect-timeout #{seconds} --max-time #{seconds+10} #{url}; /bin/echo -n $? }.to_i \r\n427\r\n\r\n428 #return false unless var == 0\r\n429 raise "Failed to create connection to web site: #{url} -- curl error code: #{var} -- " unless var == 0\r\n430 \r\n431 str = %x{ /usr/bin/curl -L --fail --silent --connect-timeout #{seconds} --max-time #{seconds+10} #{url} | \\r\n432 /usr/bin/grep -Eo -m 1 \"(charset|encoding)=[\\"']?[^\\"'>]+\" | /usr/bin/grep -Eo \"[^=\\" '>]+$\" }\r\n\r\n443 %x{ /usr/bin/touch #{downloaded_file} 2>/dev/null }\r\n444 raise "No valid HTML download file (path) specified!" unless File.file?(downloaded_file)\r\n445 %x{ /usr/bin/curl -L --fail --silent --connect-timeout #{seconds} --max-time #{seconds+10} -o #{downloaded_file} #{url} }\r\n446 \r\n447 simple_test = %x{ /usr/bin/file -ik #{downloaded_file} } # cf. man file\r\n\r\nIf the downloaded file name #{downloaded_file} or #{url} contains any shell meta characters like ';' a malicious user can inject shell commands.\r\n\r\nPoC\r\nmyfile;id;.txt\r\n\r\nid would be passed to the command line and executed.\r\n\r\nAdvisory: http://www.vapid.dhs.org/advisories/arabic-ruby-gem.html\r\n\r\n", "published": "2014-05-04T00:00:00", "modified": "2014-05-04T00:00:00", "cvss": {"score": 0.0, "vector": "NONE"}, "href": "https://vulners.com/securityvulns/SECURITYVULNS:DOC:30569", "reporter": "Securityvulns", "references": [], "cvelist": [], "type": "securityvulns", "lastseen": "2018-08-31T11:10:51", "edition": 1, "viewCount": 17, "enchantments": {"score": {"value": 6.6, "vector": "NONE"}, "dependencies": {"references": [{"type": "securityvulns", "idList": ["SECURITYVULNS:VULN:13481"]}], "rev": 4}, "backreferences": {"references": [{"type": "cve", "idList": ["CVE-2014-2322"]}, {"type": "securityvulns", "idList": ["SECURITYVULNS:VULN:13481"]}]}, "exploitation": null, "vulnersScore": 6.6}, "affectedSoftware": [], "immutableFields": [], "cvss2": {}, "cvss3": {}, "_state": {"dependencies": 1646861201}}
{}