From afed595c520dd7ed2387e83ddb081d3e407f5188 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Thu, 12 Jan 2023 14:04:08 -0500 Subject: [PATCH] Agent: Forcefully kill the LDAP server process if necessary Using Twisted for the Log4Shell exploiter has been nothing but trouble since the beginning. When we refactor this exploiter we should use another solution. In the meanwhile, we must be doing something wrong WRT stopping Twisted. The heavy-handed approach is to SIGKILL the process. This isn't ideal, but will be changed when we refactor this component. Issue #2820 --- monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py b/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py index 8065141a868..e3704dca96b 100644 --- a/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py +++ b/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py @@ -210,5 +210,7 @@ def stop(self, timeout: Optional[float] = None): if self._server_process.is_alive(): logger.warning("Timed out while waiting for the LDAP exploit server to stop") + logger.warning("Forcefully killing the LDAP server process") + self._server_process.kill() else: logger.debug("Successfully stopped the LDAP exploit server")