Skip to content

Commit 3186a4f

Browse files
committed
Fixing CI/CD errors
1 parent 311bf7c commit 3186a4f

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

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

lib/techniques/xxe/inject.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,15 @@ def _confirmRead(page, pattern, baseline):
485485
return None
486486

487487

488-
def _normalizeEscaping(text):
489-
"""Bounded, non-resolving decode of the common reflection encodings (HTML entities, percent-
490-
encoding, JS \\uXXXX / escaped slash) so an ESCAPED entity reference (&amp;e;, &#38;e;, &#x26;e;,
491-
%26e%3B, \\u0026e;) is unmasked and can be recognised as reflection rather than file content."""
488+
def _reflectsEntity(text, ent):
489+
"""True if the random entity NAME surfaces at ANY bounded de-escaping depth (raw included) - i.e.
490+
the parser echoed the reference in some encoding (&amp;e;, &#38;e;, &#x26;e;, %26e%3B, \\u0026e;)
491+
rather than expanding the external entity, so it is reflection, not file content. Checked at every
492+
step because a further round of htmlUnescape can consume an entity-name prefix that is itself a
493+
valid HTML entity (e.g. 'lt...'/'gt...'/'amp...'), which would otherwise mask the reflection."""
492494
out = getUnicode(text)
495+
if ent in out:
496+
return True
493497
for _ in range(3): # a few rounds catch double-encoding; capped
494498
prev = out
495499
try:
@@ -501,9 +505,11 @@ def _normalizeEscaping(text):
501505
except Exception:
502506
pass
503507
out = out.replace("\\u0026", "&").replace("\\u003b", ";").replace("\\/", "/")
508+
if ent in out:
509+
return True
504510
if out == prev:
505511
break
506-
return out
512+
return False
507513

508514

509515
def _readBetweenMarkers(xml, rootName, systemId, isB64, m1, m2):
@@ -521,14 +527,14 @@ def _readBetweenMarkers(xml, rootName, systemId, isB64, m1, m2):
521527
data = match.group(1)
522528
# a reflected (not expanded) entity in ANY encoding: the random entity NAME survives de-escaping ->
523529
# the parser echoed the reference, it did not resolve the external entity -> not file content
524-
if not data.strip() or ent in _normalizeEscaping(data):
530+
if not data.strip() or _reflectsEntity(data, ent):
525531
return None, payload
526532
if isB64:
527533
try:
528534
data = getText(decodeBase64(data.strip())) # strict base64 also validates real bytes
529535
except Exception:
530536
return None, payload
531-
if not data or not data.strip() or ent in _normalizeEscaping(data):
537+
if not data or not data.strip() or _reflectsEntity(data, ent):
532538
return None, payload
533539
return (data if (data and data.strip()) else None), payload
534540

0 commit comments

Comments
 (0)