Blind Exploits To Rule Watchguard Firewalls
The researcher found several vulnerabilities in WatchGuard Firebox/XTM appliances, including a blind alphanumeric buffer overflow in the XML-RPC parser of wgagent and a time-based XPath injection in the wgcgi login interface. The overflow could allow pre-authentication remote code execution, while the XPath injection could leak configuration data such as authentication server credentials.
Published on ambionics.io
Early this year, WatchGuard firewalls have been under attack multiple times, most notably by the russian APT Sandworm and their malware, Cyclops Blink. Over the course of 4 months, the editor released three firmware updates, patching numerous critical vulnerabilities.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the XML tag path was concatenated into a fixed .bss buffer with strcat() and no bounds check, and the authentication domain name was inserted into an XPath query without sanitisation.
Impact
The overflow could give pre-authentication remote root on every appliance, though the tested firmware had already been patched; the XPath injection worked but yielded no credentials because the domain was bound without a password.
What the attacker needed
Network access to the admin interface; network access to the VPN login page
The fix
The overflow was fixed in a firmware update released shortly after the researcher downloaded the firmware, and the XPath injection was assigned CVE-2022-31790 and an advisory.
How it was found
- Send an XML-RPC request whose tag names are long enough to overflow the current_xpath buffer
- Use the overflow to overwrite the first tcache entry with an alphanumeric address
- Build fake chunk headers in the gap between the buffer and the heap
- Allocate and free members to place a fake chunk over the free() GOT entry
- Overwrite the GOT entry with a system wrapper and free data to run commands
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A firewall is a device that guards a network, and its web admin interface accepts login requests. The code that reads those requests copied the name of each XML tag into a fixed memory area without checking length, so a very long tag name spilled into neighbouring memory. Separately, a login field was pasted into a query on a configuration file without cleaning, letting an attacker ask hidden questions about that file.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.