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

Skip to content

Commit 6fa5922

Browse files
committed
Bug fix (error heuristics not working in heavy dynamicity cases)
1 parent 42884d3 commit 6fa5922

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

data/xml/errors.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<error regexp="\bSQL Server[^&lt;&quot;]+Driver"/>
4343
<error regexp="Warning.*?\W(mssql|sqlsrv)_"/>
4444
<error regexp="\bSQL Server[^&lt;&quot;]+[0-9a-fA-F]{8}"/>
45-
<error regexp="System\.Data\.SqlClient\.SqlException"/>
45+
<error regexp="System\.Data\.SqlClient\.(SqlException|SqlConnection\.OnError)"/>
4646
<error regexp="(?s)Exception.*?\bRoadhouse\.Cms\."/>
4747
<error regexp="Microsoft SQL Native Client error '[0-9a-fA-F]{8}"/>
4848
<error regexp="\[SQL Server\]"/>
@@ -55,6 +55,7 @@
5555
<error regexp="com\.microsoft\.sqlserver\.jdbc"/>
5656
<error regexp="Pdo[./_\\](Mssql|SqlSrv)"/>
5757
<error regexp="SQL(Srv|Server)Exception"/>
58+
<error regexp="Unclosed quotation mark after the character string"/>
5859
</dbms>
5960

6061
<dbms value="Microsoft Access">

lib/controller/checks.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def checkSqlInjection(place, parameter, value):
157157
# error message, simple heuristic check or via DBMS-specific
158158
# payload), ask the user to limit the tests to the fingerprinted
159159
# DBMS
160+
160161
if kb.reduceTests is None and not conf.testFilter and (intersect(Backend.getErrorParsedDBMSes(), SUPPORTED_DBMS, True) or kb.heuristicDbms or injection.dbms):
161162
msg = "it looks like the back-end DBMS is '%s'. " % (Format.getErrorParsedDBMSes() or kb.heuristicDbms or joinValue(injection.dbms, '/'))
162163
msg += "Do you want to skip test payloads specific for other DBMSes? [Y/n]"
@@ -1041,11 +1042,6 @@ def heuristicCheckSqlInjection(place, parameter):
10411042
if conf.skipHeuristics:
10421043
return None
10431044

1044-
if kb.heavilyDynamic:
1045-
debugMsg = "heuristic check skipped because of heavy dynamicity"
1046-
logger.debug(debugMsg)
1047-
return None
1048-
10491045
origValue = conf.paramDict[place][parameter]
10501046
paramType = conf.method if conf.method not in (None, HTTPMETHOD.GET, HTTPMETHOD.POST) else place
10511047

@@ -1082,7 +1078,7 @@ def _(page):
10821078

10831079
casting = _(page) and not _(kb.originalPage)
10841080

1085-
if not casting and not result and kb.dynamicParameter and origValue.isdigit():
1081+
if not casting and not result and kb.dynamicParameter and origValue.isdigit() and not kb.heavilyDynamic:
10861082
randInt = int(randomInt())
10871083
payload = "%s%s%s" % (prefix, "%d-%d" % (int(origValue) + randInt, randInt), suffix)
10881084
payload = agent.payload(place, parameter, newValue=payload, where=PAYLOAD.WHERE.REPLACE)
@@ -1096,6 +1092,11 @@ def _(page):
10961092

10971093
kb.heuristicTest = HEURISTIC_TEST.CASTED if casting else HEURISTIC_TEST.NEGATIVE if not result else HEURISTIC_TEST.POSITIVE
10981094

1095+
if kb.heavilyDynamic:
1096+
debugMsg = "heuristic check stopped because of heavy dynamicity"
1097+
logger.debug(debugMsg)
1098+
return kb.heuristicTest
1099+
10991100
if casting:
11001101
errMsg = "possible %s casting detected (e.g. '" % ("integer" if origValue.isdigit() else "type")
11011102

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.5.1.28"
21+
VERSION = "1.5.1.29"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

0 commit comments

Comments
 (0)