Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7e8ac16

Browse files
committed
Added preventive check for stacked queries support when executing DDL,
DML & co. statements in SQL query and SQL shell. Minor improvements on this new feature. Increased default connection timeout to 30 seconds (needed for vmware machine not correctly synched).
1 parent ad228e6 commit 7e8ac16

5 files changed

Lines changed: 38 additions & 17 deletions

File tree

doc/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ sqlmap (0.6.4-1) stable; urgency=low
22

33
* Major improvement to the comparison algorithm to make it work also if
44
the page content changes at each refresh; (work in progress)
5+
* Major enhancement to support SQL data definition statements, SQL data
6+
manipulation statements, etc from user in SQL query and SQL shell if
7+
stacked queries are supported by the web application technology in
8+
use;
59
* Minor enhancement to support an option (--is-dba) to show if the
610
current user is a database management system administrator;
711
* Added support internally to forge CASE statements, used only by

lib/core/option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def __setHTTPTimeout():
522522

523523
conf.timeout = 3.0
524524
else:
525-
conf.timeout = 10.0
525+
conf.timeout = 30.0
526526

527527
socket.setdefaulttimeout(conf.timeout)
528528

lib/parse/cmdline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def cmdLineParser():
109109

110110
request.add_option("--timeout", dest="timeout", type="float",
111111
help="Seconds to wait before timeout connection "
112-
"(default 10)")
112+
"(default 30)")
113113

114114

115115
# Injection options

plugins/generic/enumeration.py

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from lib.parse.banner import bannerParser
4646
from lib.request import inject
4747
from lib.request.connect import Connect as Request
48+
from lib.techniques.outband.stacked import stackedTest
4849

4950

5051
class Enumeration:
@@ -1053,24 +1054,36 @@ def sqlQuery(self, query):
10531054

10541055
break
10551056

1056-
if sqlType:
1057+
if selectQuery == True:
10571058
infoMsg = "fetching %s query output: '%s'" % (sqlType, query)
1059+
logger.info(infoMsg)
1060+
1061+
output = inject.getValue(query, fromUser=True)
10581062
else:
1059-
infoMsg = "fetching SQL query output: '%s'" % query
1063+
if kb.stackedTest == None:
1064+
stackedTest()
10601065

1061-
logger.info(infoMsg)
1066+
if kb.stackedTest == False:
1067+
warnMsg = "the web application does not support "
1068+
warnMsg += "stacked queries"
1069+
logger.warn(warnMsg)
10621070

1063-
if selectQuery == False:
1064-
# TODO: test if stacked queries are supported by the web
1065-
# application before injecting
1066-
inject.goStacked(query)
1067-
else:
1068-
output = inject.getValue(query, fromUser=True)
1071+
return None
1072+
else:
1073+
if sqlType:
1074+
infoMsg = "executing %s query: '%s'" % (sqlType, query)
1075+
else:
1076+
infoMsg = "executing unknown SQL type query: '%s'" % query
1077+
logger.info(infoMsg)
10691078

1070-
if output == "Quit":
1071-
return None
1072-
else:
1073-
return output
1079+
inject.goStacked(query)
1080+
1081+
infoMsg = "done"
1082+
logger.info(infoMsg)
1083+
1084+
output = False
1085+
1086+
return output
10741087

10751088

10761089
def sqlShell(self):
@@ -1105,5 +1118,9 @@ def sqlShell(self):
11051118

11061119
if output and output != "Quit":
11071120
dumper.string(query, output)
1121+
1122+
elif output == False:
1123+
pass
1124+
11081125
elif output != "Quit":
11091126
print "No output"

sqlmap.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ delay = 0
7979

8080
# Seconds to wait before timeout connection.
8181
# Valid: float
82-
# Default: 10
83-
timeout = 10
82+
# Default: 30
83+
timeout = 30
8484

8585

8686
[Injection]

0 commit comments

Comments
 (0)