Rapid7 Vulnerability & Exploit Database

Dlink DIR Routers Unauthenticated HNAP Login Stack Buffer Overflow

Back to Search

Dlink DIR Routers Unauthenticated HNAP Login Stack Buffer Overflow

Disclosed
11/07/2016
Created
05/30/2018

Description

Several Dlink routers contain a pre-authentication stack buffer overflow vulnerability, which is exposed on the LAN interface on port 80. This vulnerability affects the HNAP SOAP protocol, which accepts arbitrarily long strings into certain XML parameters and then copies them into the stack. This exploit has been tested on the real devices DIR-818LW and 868L (rev. B), and it was tested using emulation on the DIR-822, 823, 880, 885, 890 and 895. Others might be affected, and this vulnerability is present in both MIPS and ARM devices. The MIPS devices are powered by Lextra RLX processors, which are crippled MIPS cores lacking a few load and store instructions. Because of this the payloads have to be sent unencoded, which can cause them to fail, although the bind shell seems to work well. For the ARM devices, the inline reverse tcp seems to work best. Check the reference links to see the vulnerable firmware versions.

Author(s)

  • Pedro Ribeiro <pedrib@gmail.com>

Platform

Linux

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/linux/http/dlink_hnap_login_bof
msf exploit(dlink_hnap_login_bof) > show targets
    ...targets...
msf exploit(dlink_hnap_login_bof) > set TARGET < target-id >
msf exploit(dlink_hnap_login_bof) > show options
    ...show and set options...
msf exploit(dlink_hnap_login_bof) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;