TP-Link Takeover with a Flash Drive
A malicious USB drive containing symbolic links could be used to read the router's file system pre-authentication and steal the admin password, and after logging in, to write files and achieve root code execution. An attacker with physical access and network connectivity could gain a root shell.
medium.com
Published on medium.com
Tenable TechBlog
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 DLNA server followed symbolic links without restricting them to the USB drive, and the FTP server allowed writing to a script executed by a scheduled job.
Impact
An attacker with physical access and network connectivity could read sensitive files, steal admin credentials, and gain a root shell, potentially using the router for VPN or sniffing.
What the attacker needed
Physical access to the router; ability to plug in a USB drive; network connectivity to the router
The fix
TP-Link has provided a patch for this; update to the latest firmware.
How it was found
- Create symbolic links on an NTFS USB drive pointing to sensitive files like /etc/shadow and /etc/config/usbshare, naming them with media extensions.
- Plug the USB drive into the router.
- Access the symbolic links over DLNA (e.g., using VLC) to read the files and obtain the admin password.
- Log in to the web interface with the stolen credentials.
- Configure the USB sharing settings to point the network share to a symbolic link named 'rootfs' that points to the root directory.
- Use FTP to upload a malicious script and overwrite /usr/sbin/wan_connected to execute it, gaining a root shell.
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 symbolic link is like a shortcut that points to another file. The router's DLNA media server followed these shortcuts even when they pointed to sensitive system files, letting an attacker read them. After logging in with stolen credentials, the attacker could write to a file that the system ran regularly, giving them full control.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.