Skip to content
RCE Write-up Advanced

Pwn2Own: WAN-to-LAN Exploit Showcase

The TP-Link ER605 router's Comexe DDNS client used a hardcoded symmetric key with no server authentication, and its packet and DNS-name parsing copied attacker-controlled data into fixed-size buffers without length checks. An attacker who could intercept DDNS traffic could impersonate the provider, leak memory to defeat ASLR, and run a ROP chain to get root code execution on the router.

claroty.com

Published on claroty.com

Almost anyone connecting to the internet from a small office / home office (SOHO) network does so from a similar network layout. The most essential device to bridge between the local network to the internet is the router.

Sharon Brizinov, on claroty.com

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 DDNS client relied on a hardcoded symmetric key instead of real server authentication, and its parsers copied user-supplied lengths into fixed-size stack and global buffers without bounds checks.

Impact

An attacker able to intercept the router's DDNS traffic could gain root code execution on the router and then pivot into the local network, though devices are only affected if configured to use the Comexe DDNS service.

What the attacker needed

Router uses Comexe DDNS; attacker can intercept WAN DDNS traffic; no authentication needed

The fix

TP-Link fixed the issues in firmware version ER605 (UN) V22.2.4 Build 20240119.

How it was found

  1. Position yourself on the WAN side so you can intercept traffic between the router and the Comexe DDNS servers.
  2. Send oversized UpdateSvr1 and UpdateSvr2 domain values to overflow the global buffer holding the DDNS server names.
  3. Trigger the DNS query routine so the oversized name overflows the stack and enlarges the send-size variable, leaking stack pointers in the DNS query.
  4. Use the leaked pointers to calculate the base addresses of the stack and libc.
  5. Send a DDNS response with an oversized errorCode value to overflow the stack in the packet-check function and start the ROP chain.
  6. Call system with the chosen command to run it as root on the router.

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 router keeps your home network separate from the internet, so a bug in it is serious. Here the router trusted a service it talks to without checking who it really was, and it also copied data from that service into small memory slots without checking the size, so extra data spilled over and let the attacker take control. The attacker also had to be able to sit between the router and that service, which is not something just anyone on the internet can do.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.