Skip to content

Commit c878dd3

Browse files
committed
doing a dummy test for --os-shell in case of xp_cmdshell
1 parent 4ac2611 commit c878dd3

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

lib/controller/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def _():
562562
retVal = None
563563

564564
if retVal is None:
565-
warnMsg = "false positive and/or unexploitable injection point detected"
565+
warnMsg = "false positive or unexploitable injection point detected"
566566
logger.warn(warnMsg)
567567

568568
kb.injection = popValue()

lib/takeover/abstraction.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@
1010
from extra.safe2bin.safe2bin import safechardecode
1111
from lib.core.common import dataToStdout
1212
from lib.core.common import Backend
13+
from lib.core.common import isNoneValue
1314
from lib.core.common import isTechniqueAvailable
15+
from lib.core.common import pushValue
1416
from lib.core.common import readInput
17+
from lib.core.common import popValue
1518
from lib.core.data import conf
1619
from lib.core.data import logger
1720
from lib.core.enums import DBMS
1821
from lib.core.enums import PAYLOAD
22+
from lib.core.exception import sqlmapGenericException
1923
from lib.core.exception import sqlmapUnsupportedFeatureException
2024
from lib.core.shell import autoCompletion
25+
from lib.core.threads import getCurrentThreadData
2126
from lib.takeover.udf import UDF
2227
from lib.takeover.web import Web
2328
from lib.takeover.xp_cmdshell import xp_cmdshell
@@ -108,6 +113,19 @@ def shell(self):
108113
infoMsg += "operating system command execution"
109114
logger.info(infoMsg)
110115

116+
threadData = getCurrentThreadData()
117+
pushValue(threadData.disableStdOut)
118+
threadData.disableStdOut = True
119+
120+
output = self.evalCmd("echo 1")
121+
if isNoneValue(output):
122+
errMsg = "it seems that the temporary directory ('%s') used for storing " % self.getRemoteTempPath()
123+
errMsg += "console output at the back-end OS does not have "
124+
errMsg += "writing permissions for the DBMS process. You are advised "
125+
errMsg += "to manually adjust it with option '--tmp-path'"
126+
raise sqlmapGenericException, errMsg
127+
128+
threadData.disableStdOut = popValue()
111129
else:
112130
errMsg = "feature not yet implemented for the back-end DBMS"
113131
raise sqlmapUnsupportedFeatureException, errMsg

plugins/generic/misc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def getRemoteTempPath(self):
6060

6161
hashDBWrite(HASHDB_KEYS.CONF_TMP_PATH, conf.tmpPath)
6262

63+
return conf.tmpPath
64+
6365
def getVersionFromBanner(self):
6466
if "dbmsVersion" in kb.bannerFp:
6567
return

0 commit comments

Comments
 (0)