Skip to content

Commit 3d4bfb3

Browse files
committed
More appropriate warning message, got rid of a TODO
1 parent b4fd71e commit 3d4bfb3

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

plugins/dbms/mssqlserver.py

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -590,37 +590,19 @@ def uncPathRequest(self):
590590

591591

592592
def overflowBypassDEP(self):
593-
# TODO: use 'sc' to:
594-
# * Get the SQL Server 'Service name' (usually MSSQLSERVER)
595-
# * Detect the absolute SQL Server executable file path
596-
#
597-
# References:
598-
# * http://www.ss64.com/nt/sc.html
599-
# * http://www.ss64.com/nt/for_cmd.html
600593
self.handleDep("C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe")
601594

602595
if self.bypassDEP == False:
603596
return
604-
605-
logger.info("restarting Microsoft SQL Server, wait..")
606-
time.sleep(15)
607-
608-
# TODO: use 'sc' to:
609-
# * Warn the user that sqlmap needs to restart the SQL Server
610-
# service, ask for confirmation
611-
# * Stop the SQL Server service (after handling DEP)
612-
# * Start the SQL Server service (after handling DEP)
613-
614-
# Another way to restart MSSQL consists of writing a bat file with
615-
# the following text:
616-
#
617-
#@ECHO OFF
618-
#NET STOP MSSQLSERVER
619-
#NET START MSSQLSERVER
620-
#
621-
# Then run the following statement and wait a few seconds:
622-
#
623-
# exec master..xp_cmdshell 'start C:\WINDOWS\Temp\sqlmaprandom.bat'
597+
else:
598+
warnMsg = "sqlmap tried to add the expection for "
599+
warnMsg += "'sqlservr.exe' within the registry, but will not "
600+
warnMsg += "restart the MSSQLSERVER process to avoid denial "
601+
warnMsg += "of service. The buffer overflow trigger could not "
602+
warnMsg += "work, however sqlmap will give it a try. Soon "
603+
warnMsg += "it will come a new MS09-004 exploit to "
604+
warnMsg += "automatically bypass DEP."
605+
logger.warn(warnMsg)
624606

625607

626608
def spHeapOverflow(self):

0 commit comments

Comments
 (0)