Rapid7 Vulnerability & Exploit Database

Zyxel chained RCE using LFI and weak password derivation algorithm

Back to Search

Zyxel chained RCE using LFI and weak password derivation algorithm

Disclosed
02/01/2022
Created
05/10/2023

Description

This module exploits multiple vulnerabilities in the `zhttpd` binary (/bin/zhttpd) and `zcmd` binary (/bin/zcmd). It is present on more than 40 Zyxel routers and CPE devices. The remote code execution vulnerability can be exploited by chaining the local file disclosure vulnerability in the zhttpd binary that allows an unauthenticated attacker to read the entire configuration of the router via the vulnerable endpoint `/Export_Log?/data/zcfg_config.json`. With this information disclosure, the attacker can determine if the router is reachable via ssh and use the second vulnerability in the `zcmd` binary to derive the `supervisor` password exploiting a weak implementation of a password derivation algorithm using the device serial number. After exploitation, an attacker will be able to execute any command as user `supervisor`.

Author(s)

  • h00die-gr3y <h00die.gr3y@gmail.com>
  • SEC Consult Vulnerability Lab
  • Thomas Rinsma
  • Bogi Napoleon Wennerstrøm

Platform

Linux,Unix

Architectures

cmd, mipsbe

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/zyxel_lfi_unauth_ssh_rce
msf exploit(zyxel_lfi_unauth_ssh_rce) > show targets
    ...targets...
msf exploit(zyxel_lfi_unauth_ssh_rce) > set TARGET < target-id >
msf exploit(zyxel_lfi_unauth_ssh_rce) > show options
    ...show and set options...
msf exploit(zyxel_lfi_unauth_ssh_rce) > 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

;