Skip to content

Commit 9e5ef09

Browse files
committed
1 parent e4b23c9 commit 9e5ef09

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/core/agent.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from lib.core.enums import PLACE
3434
from lib.core.enums import POST_HINT
3535
from lib.core.exception import SqlmapNoneDataException
36+
from lib.core.settings import BOUNDARY_BACKSLASH_MARKER
3637
from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR
3738
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
3839
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
@@ -187,6 +188,9 @@ def _(pattern, repl, string):
187188
if retVal == paramString and urlencode(parameter) != parameter:
188189
retVal = _(r"(\A|\b)%s=%s" % (re.escape(urlencode(parameter)), re.escape(origValue)), "%s=%s" % (urlencode(parameter), self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString)
189190

191+
if retVal:
192+
retVal = retVal.replace(BOUNDARY_BACKSLASH_MARKER, '\\')
193+
190194
return retVal
191195

192196
def fullPayload(self, query):
@@ -237,7 +241,7 @@ def prefixQuery(self, expression, prefix=None, where=None, clause=None):
237241
if not (expression and expression[0] == ';') and not (query and query[-1] in ('(', ')') and expression and expression[0] in ('(', ')')) and not (query and query[-1] == '('):
238242
query += " "
239243

240-
query = "%s%s" % (query, expression)
244+
query = "%s%s" % (query.replace('\\', BOUNDARY_BACKSLASH_MARKER), expression)
241245

242246
return query
243247

@@ -271,7 +275,7 @@ def suffixQuery(self, expression, comment=None, suffix=None, where=None):
271275
pass
272276

273277
elif suffix and not comment:
274-
expression += suffix
278+
expression += suffix.replace('\\', BOUNDARY_BACKSLASH_MARKER)
275279

276280
return re.sub(r"(?s);\W*;", ";", expression)
277281

lib/core/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
# Markers for special cases when parameter values contain html encoded characters
5151
PARAMETER_AMP_MARKER = "__AMP__"
5252
PARAMETER_SEMICOLON_MARKER = "__SEMICOLON__"
53+
BOUNDARY_BACKSLASH_MARKER = "__BACKSLASH__"
5354
PARTIAL_VALUE_MARKER = "__PARTIAL_VALUE__"
5455
PARTIAL_HEX_VALUE_MARKER = "__PARTIAL_HEX_VALUE__"
5556
URI_QUESTION_MARKER = "__QUESTION_MARK__"

0 commit comments

Comments
 (0)