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

Skip to content

Commit 4f122ee

Browse files
committed
Bug fix regarding a problem reported by user @blink2014
1 parent 6cb76bc commit 4f122ee

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

lib/core/agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def _(pattern, repl, string):
162162
match = None
163163
for match in re.finditer(pattern, string):
164164
pass
165+
165166
if match:
166167
while True:
167168
_ = re.search(r"\\g<([^>]+)>", repl)
@@ -173,7 +174,8 @@ def _(pattern, repl, string):
173174
return retVal
174175

175176
if origValue:
176-
retVal = _(r"(\A|\b)%s=%s(\Z|\b)" % (re.escape(parameter), re.escape(origValue)), "%s=%s" % (parameter, self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString)
177+
regex = r"(\A|\b)%s=%s%s" % (re.escape(parameter), re.escape(origValue), r"(\Z|\b)" if origValue[-1].isalnum() else "")
178+
retVal = _(regex, "%s=%s" % (parameter, self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString)
177179
else:
178180
retVal = _(r"(\A|\b)%s=%s(\Z|%s|%s|\s)" % (re.escape(parameter), re.escape(origValue), DEFAULT_GET_POST_DELIMITER, DEFAULT_COOKIE_DELIMITER), "%s=%s\g<2>" % (parameter, self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString)
179181
if retVal == paramString and urlencode(parameter) != parameter:

lib/core/common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
9898
from lib.core.settings import DEFAULT_MSSQL_SCHEMA
9999
from lib.core.settings import DESCRIPTION
100-
from lib.core.settings import DUMMY_SQL_INJECTION_CHARS
101100
from lib.core.settings import DUMMY_USER_INJECTION
102101
from lib.core.settings import DYNAMICITY_MARK_LENGTH
103102
from lib.core.settings import ERROR_PARSING_REGEXES
@@ -573,7 +572,7 @@ def paramToDict(place, parameters=None):
573572
testableParameters[parameter] = "=".join(parts[1:])
574573
if not conf.multipleTargets and not (conf.csrfToken and parameter == conf.csrfToken):
575574
_ = urldecode(testableParameters[parameter], convall=True)
576-
if (_.strip(DUMMY_SQL_INJECTION_CHARS) != _\
575+
if (_.endswith("'") and _.count("'") == 1
577576
or re.search(r'\A9{3,}', _) or re.search(DUMMY_USER_INJECTION, _))\
578577
and not parameter.upper().startswith(GOOGLE_ANALYTICS_COOKIE_PREFIX):
579578
warnMsg = "it appears that you have provided tainted parameter values "

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@
412412
DUMMY_SQL_INJECTION_CHARS = ";()'"
413413

414414
# Simple check against dummy users
415-
DUMMY_USER_INJECTION = r"(?i)[^\w](AND|OR)\s+[^\s]+[=><]|\bUNION\b.+\bSELECT\b|\A-\d+\Z"
415+
DUMMY_USER_INJECTION = r"(?i)[^\w](AND|OR)\s+[^\s]+[=><]|\bUNION\b.+\bSELECT\b|\bSELECT\b.+\bFROM\b|\b(CONCAT|information_schema|SLEEP|DELAY)\b"
416416

417417
# Extensions skipped by crawler
418418
CRAWL_EXCLUDE_EXTENSIONS = ("gif", "jpg", "jpeg", "image", "jar", "tif", "bmp", "war", "ear", "mpg", "mpeg", "wmv", "mpeg", "scm", "iso", "dmp", "dll", "cab", "so", "avi", "mkv", "bin", "iso", "tar", "png", "pdf", "ps", "wav", "mp3", "mp4", "au", "aiff", "aac", "zip", "rar", "7z", "gz", "flv", "mov", "doc", "docx", "xls", "dot", "dotx", "xlt", "xlsx", "ppt", "pps", "pptx")

xml/errors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<dbms value="MySQL">
66
<error regexp="SQL syntax.*MySQL"/>
77
<error regexp="Warning.*mysql_.*"/>
8+
<error regexp="MySqlException \(0x"/>
89
<error regexp="valid MySQL result"/>
910
<error regexp="MySqlClient\."/>
1011
<error regexp="com\.mysql\.jdbc\.exceptions"/>

0 commit comments

Comments
 (0)