Security researchers with HN Security have published technical details on two vulnerabilities affecting many Zyxel products.

Tracked as CVE-2022-26531 and CVE-2022-26532, the two security holes were addressed in late May 2022 with patches for multiple firewalls, access points (APs), and AP controllers.

The vulnerabilities impact the Zyxel zysh binary, a restricted shell that implements the command-line interface (CLI) on a variety of Zyxel products. The CLI can be accessed via SSH and Telnet (which is not enabled by default), or via a web console, reachable via a browser.

HN Security’s researchers identified multiple issues in the binary, including several stack-based buffer overflows in code that handles diagnostic tests, two stack-based buffer overflows in the “debug” and “ssh” commands, several format string bugs, and a command injection bug.

“We demonstrated the possibility, as an authenticated admin or limited-admin user, to exploit the format string bugs and the OS command injection vulnerability to escape the restricted shell environment and achieve arbitrary command execution on the underlying embedded Linux OS, respectively as regular user and as root,” the researchers say.

The identified buffer overflows, the researchers say, existed because of unsafe API function calls. In fact, the researchers note that the zysh binary does not pack modern countermeasures against exploitation of memory corruption bugs.

Despite that, however, the buffer overflows could not be exploited to achieve code execution.

“Some zysh commands implement a special ‘extension’ argument that allows to specify arbitrary command-line arguments to be passed to the invoked OS command that underlies each functionality. Any additional arguments we specify after the ‘extension’ keyword are appended to the OS command line. We identified format string bugs in multiple zysh commands that implement this feature,” HN Security says.

The researchers were able to exploit these format string bugs to achieve arbitrary code execution and to escape the restricted shell environment and have published proof-of-concept exploit code to prove that. They also note that automating and weaponizing the exploit might not be too hard.

Zyxel collectively assigned the identifier CVE-2022-26531 for the memory corruption bugs, but addressed the OS command injection issue – which is tracked as CVE-2022-26532 – separately.

This vulnerability, HN Security explains, was found in the code that handles the “packet-trace” command. The researchers discovered that they could abuse the “extension-filter” argument to “specify additional arbitrary command-line arguments to be passed to tcpdump,” which allowed them to execute arbitrary code as root.

On May 24, Zyxel published a security advisory to announce patches for CVE-2022-26531, CVE-2022-26532, and two other vulnerabilities impacting the same product range (tracked as CVE-2022-0734 and CVE-2022-0910).

Impacted products include USG/ZyWALL, USG FLEX, ATP, VPN, and NSG firewalls, NXC2500 and NXC5500 AP controllers, and nearly 30 access point products.

Related: Zyxel Firewall Vulnerability Exploitation Attempts Seen One Day After Disclosure

Related: Critical Vulnerability Allows Remote Hacking of Zyxel Firewalls

Related: Zyxel Warns Customers of Attacks on Security Appliances

Ionut Arghire is an international correspondent for SecurityWeek.

Previous Columns by Ionut Arghire:
Tags: