Tp-Link AX53 v1.0 tdpServer ssh port update stack-based buffer overflow vulnerability
The tdpServer service on the TP-Link Archer AX53 router copies the user-supplied ssh_port string into a small stack buffer without checking its length. An attacker who sends a crafted UDP packet to the service can overflow that buffer and corrupt stack memory, potentially leading to code execution.
Originally disclosed on Cisco Talos
A stack-based buffer overflow vulnerability exists in the tdpServer ssh port update functionality of Tp-Link AX53 v1.0 1.3.1 Build 20241120 rel.54901(5553). A specially crafted network packet can lead to stack-based buffer overflow.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The ssh_port string is copied with strcpy into a small fixed-size stack buffer after atoi accepts a value like '22' followed by extra characters, so the length is never validated.
Impact
An unauthenticated attacker on the network could corrupt stack memory and potentially achieve code execution, as the crash dump shows attacker-controlled values in registers.
What the attacker needed
Network access to UDP port 20002; no authentication needed
The fix
The vendor released a patch; the code should also validate the length of the ssh_port string before copying it into the fixed-size buffer.
How it was found
- Send a UDP packet to port 20002 with a valid header and checksum.
- Set the opcode to the probe type and the reserved byte to the value that routes to opcode processing.
- Include a JSON body whose method field is probe or probe_response.
- Put a value in the ssh_port field that starts with a valid port number followed by extra characters.
- The server copies the whole string into the small stack buffer and overflows it.
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 report has not been written yet. The Original tab links to the source.
A router runs a small background program that listens for network messages. That program takes a text value from the message and copies it into a fixed-size space in memory without checking how long it is. If the text is too long, it spills over into neighbouring memory, which can crash the program or let an attacker take control of it.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.