Skip to content

Commit d91530f

Browse files
committed
Merge branch 'master' of github.com:sqlmapproject/sqlmap
2 parents 52264f5 + fdf00e4 commit d91530f

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2810,7 +2810,7 @@ def safeSQLIdentificatorNaming(name, isTable=False):
28102810
if _:
28112811
retVal = re.sub(r"(?i)\A%s\." % DEFAULT_MSSQL_SCHEMA, "", retVal)
28122812

2813-
if not re.match(r"\A[A-Za-z0-9_@%s\$]+\Z" % ("." if _ else ""), retVal): # MsSQL is the only DBMS where we automatically prepend schema to table name (dot is normal)
2813+
if retVal.upper() in kb.keywords or not re.match(r"\A[A-Za-z0-9_@%s\$]+\Z" % ("." if _ else ""), retVal): # MsSQL is the only DBMS where we automatically prepend schema to table name (dot is normal)
28142814
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ACCESS):
28152815
retVal = "`%s`" % retVal.strip("`")
28162816
elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.PGSQL, DBMS.DB2):

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@
370370
# Extensions skipped by crawler
371371
CRAWL_EXCLUDE_EXTENSIONS = ("gif", "jpg", "jar", "tif", "bmp", "war", "ear", "mpg", "wmv", "mpeg", "scm", "iso", "dmp", "dll", "cab", "so", "avi", "bin", "exe", "iso", "tar", "png", "pdf", "ps", "mp3", "zip", "rar", "gz")
372372

373+
# Patterns often seen in HTTP headers containing custom injection marking character
374+
PROBLEMATIC_CUSTOM_INJECTION_PATTERNS = r"(\bq=[^;']+)|(\*/\*)"
375+
373376
# Template used for common table existence check
374377
BRUTE_TABLE_EXISTS_TEMPLATE = "EXISTS(SELECT %d FROM %s)"
375378

lib/core/target.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from lib.core.settings import HOST_ALIASES
4646
from lib.core.settings import JSON_RECOGNITION_REGEX
4747
from lib.core.settings import MULTIPART_RECOGNITION_REGEX
48+
from lib.core.settings import PROBLEMATIC_CUSTOM_INJECTION_PATTERNS
4849
from lib.core.settings import REFERER_ALIASES
4950
from lib.core.settings import RESULTS_FILE_FORMAT
5051
from lib.core.settings import SOAP_RECOGNITION_REGEX
@@ -168,7 +169,7 @@ def process(match, repl):
168169
raise SqlmapUserQuitException
169170

170171
for place, value in ((PLACE.URI, conf.url), (PLACE.CUSTOM_POST, conf.data), (PLACE.CUSTOM_HEADER, str(conf.httpHeaders))):
171-
_ = re.sub(r"\bq=[^;']+", "", value or "") if place == PLACE.CUSTOM_HEADER else value or ""
172+
_ = re.sub(PROBLEMATIC_CUSTOM_INJECTION_PATTERNS, "", value or "") if place == PLACE.CUSTOM_HEADER else value or ""
172173
if CUSTOM_INJECTION_MARK_CHAR in _:
173174
if kb.processUserMarks is None:
174175
lut = {PLACE.URI: '-u', PLACE.CUSTOM_POST: '--data', PLACE.CUSTOM_HEADER: '--headers/--user-agent/--referer/--cookie'}
@@ -206,7 +207,7 @@ def process(match, repl):
206207
if place == PLACE.CUSTOM_HEADER:
207208
for index in xrange(len(conf.httpHeaders)):
208209
header, value = conf.httpHeaders[index]
209-
if CUSTOM_INJECTION_MARK_CHAR in re.sub(r"\bq=[^;']+", "", value):
210+
if CUSTOM_INJECTION_MARK_CHAR in re.sub(PROBLEMATIC_CUSTOM_INJECTION_PATTERNS, "", value):
210211
parts = value.split(CUSTOM_INJECTION_MARK_CHAR)
211212
for i in xrange(len(parts) - 1):
212213
conf.paramDict[place]["%s #%d%s" % (header, i + 1, CUSTOM_INJECTION_MARK_CHAR)] = "%s,%s" % (header, "".join("%s%s" % (parts[j], CUSTOM_INJECTION_MARK_CHAR if i == j else "") for j in xrange(len(parts))))

0 commit comments

Comments
 (0)