From b72ad39aa6dc4cc043493ac5f32287d6cf5df128 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 12 Jan 2022 10:53:10 -0500 Subject: [PATCH] Agent: Invoke reactor.stop() with reactor.callFromThread() --- .../infection_monkey/exploit/log4shell_utils/ldap_server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py b/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py index e6efac5ff..f0acac141 100644 --- a/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py +++ b/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py @@ -89,4 +89,7 @@ class LDAPExploitServer: reactor.run(installSignalHandlers=0) def stop(self): - reactor.stop() + # Since `reactor.run()` may not be running on the main thread, reactor.stop() must be + # invoked with reactor.callFromThread() + # https://twistedmatrix.com/documents/12.2.0/core/howto/threading.html + reactor.callFromThread(reactor.stop)