diff --git a/data/xml/boundaries.xml b/data/xml/boundaries.xml
index 752f243bb..541ab7968 100644
--- a/data/xml/boundaries.xml
+++ b/data/xml/boundaries.xml
@@ -502,7 +502,7 @@ Formats:
4
1
1
- 1
+ 6
` WHERE [RANDNUM]=[RANDNUM]
[GENERIC_SQL_COMMENT]
@@ -511,7 +511,7 @@ Formats:
5
1
1
- 1
+ 6
`) WHERE [RANDNUM]=[RANDNUM]
[GENERIC_SQL_COMMENT]
diff --git a/lib/core/settings.py b/lib/core/settings.py
index eaa1f9216..66481f1d2 100644
--- a/lib/core/settings.py
+++ b/lib/core/settings.py
@@ -20,7 +20,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (...)
-VERSION = "1.10.7.147"
+VERSION = "1.10.7.148"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
diff --git a/tests/test_payloads_structure.py b/tests/test_payloads_structure.py
index 51796da32..504f4288e 100644
--- a/tests/test_payloads_structure.py
+++ b/tests/test_payloads_structure.py
@@ -105,6 +105,26 @@ class TestBoundaryEntries(unittest.TestCase):
for b in conf.boundaries:
self.assertTrue(isinstance(b.clause, (list, tuple)), msg="boundary clause not list-like")
+ def test_ptype_in_range(self):
+ # ptype feeds the recorded injection identity (report label, (place,parameter,ptype) dedup
+ # key, session hash) - an out-of-range value silently corrupts all three
+ for b in conf.boundaries:
+ self.assertIn(b.ptype, (1, 2, 3, 4, 5, 6), msg="boundary %r bad ptype %r" % (b.prefix, b.ptype))
+
+ def test_ptype_matches_prefix_quote(self):
+ # The lexical quote a prefix opens with must agree with ptype (else the injection is recorded
+ # under the wrong type - e.g. a backtick identifier breakout mislabelled numeric). Only the
+ # unambiguous cases are asserted: backtick is ALWAYS an identifier delimiter (ptype 6), and a
+ # leading single quote is ALWAYS a single-quoted string (ptype 2/3). Double quote is left out
+ # on purpose - it is a string literal (4/5) under some DBMS and an ANSI identifier (6) under
+ # others, so it is genuinely ambiguous from the prefix alone.
+ for b in conf.boundaries:
+ prefix = (b.prefix or "").lstrip()
+ if prefix.startswith('`'):
+ self.assertEqual(b.ptype, 6, msg="backtick prefix %r must be identifier ptype 6, got %r" % (b.prefix, b.ptype))
+ elif prefix.startswith("'"):
+ self.assertIn(b.ptype, (2, 3), msg="single-quote prefix %r must be ptype 2/3, got %r" % (b.prefix, b.ptype))
+
if __name__ == "__main__":
unittest.main(verbosity=2)