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

Skip to content

Commit ce37496

Browse files
committed
Minor revisit of payload boundaries (Issue #1800)
1 parent bcfae99 commit ce37496

5 files changed

Lines changed: 43 additions & 43 deletions

File tree

lib/core/agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def suffixQuery(self, expression, comment=None, suffix=None, where=None):
274274
where = kb.injection.data[kb.technique].where if where is None else where
275275
comment = kb.injection.data[kb.technique].comment if comment is None else comment
276276

277-
if Backend.getIdentifiedDbms() == DBMS.ACCESS and comment == GENERIC_SQL_COMMENT:
277+
if Backend.getIdentifiedDbms() == DBMS.ACCESS and "--" in comment:
278278
comment = queries[DBMS.ACCESS].comment.query
279279

280280
if comment is not None:
@@ -297,7 +297,7 @@ def cleanupPayload(self, payload, origValue=None):
297297
_ = (
298298
("[DELIMITER_START]", kb.chars.start), ("[DELIMITER_STOP]", kb.chars.stop),\
299299
("[AT_REPLACE]", kb.chars.at), ("[SPACE_REPLACE]", kb.chars.space), ("[DOLLAR_REPLACE]", kb.chars.dollar),\
300-
("[HASH_REPLACE]", kb.chars.hash_),
300+
("[HASH_REPLACE]", kb.chars.hash_), ("[GENERIC_SQL_COMMENT]", GENERIC_SQL_COMMENT)
301301
)
302302
payload = reduce(lambda x, y: x.replace(y[0], y[1]), _, payload)
303303

lib/core/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from lib.core.revision import getRevisionNumber
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.0.4.6"
23+
VERSION = "1.0.4.7"
2424
REVISION = getRevisionNumber()
2525
STABLE = VERSION.count('.') <= 2
2626
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")
@@ -578,7 +578,7 @@
578578
LARGE_CHUNK_TRIM_MARKER = "__TRIMMED_CONTENT__"
579579

580580
# Generic SQL comment formation
581-
GENERIC_SQL_COMMENT = "-- -"
581+
GENERIC_SQL_COMMENT = "-- [RANDSTR]"
582582

583583
# Threshold value for turning back on time auto-adjustment mechanism
584584
VALID_TIME_CHARS_RUN_THRESHOLD = 100

xml/boundaries.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Formats:
8989
<where>1,2</where>
9090
<ptype>2</ptype>
9191
<prefix>')</prefix>
92-
<suffix></suffix>
92+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
9393
</boundary>
9494

9595
<boundary>
@@ -98,7 +98,7 @@ Formats:
9898
<where>1,2</where>
9999
<ptype>2</ptype>
100100
<prefix>'</prefix>
101-
<suffix></suffix>
101+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
102102
</boundary>
103103

104104
<boundary>
@@ -107,7 +107,7 @@ Formats:
107107
<where>1,2</where>
108108
<ptype>4</ptype>
109109
<prefix>"</prefix>
110-
<suffix></suffix>
110+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
111111
</boundary>
112112
<!-- End of generic boundaries -->
113113

@@ -406,7 +406,7 @@ Formats:
406406
<where>1,2</where>
407407
<ptype>1</ptype>
408408
<prefix></prefix>
409-
<suffix>-- [RANDSTR]</suffix>
409+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
410410
</boundary>
411411

412412
<boundary>
@@ -426,7 +426,7 @@ Formats:
426426
<where>1,2</where>
427427
<ptype>2</ptype>
428428
<prefix>') WHERE [RANDNUM]=[RANDNUM]</prefix>
429-
<suffix>-- </suffix>
429+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
430430
</boundary>
431431

432432
<boundary>
@@ -435,7 +435,7 @@ Formats:
435435
<where>1,2</where>
436436
<ptype>2</ptype>
437437
<prefix>") WHERE [RANDNUM]=[RANDNUM]</prefix>
438-
<suffix>-- </suffix>
438+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
439439
</boundary>
440440

441441
<boundary>
@@ -444,7 +444,7 @@ Formats:
444444
<where>1,2</where>
445445
<ptype>1</ptype>
446446
<prefix>) WHERE [RANDNUM]=[RANDNUM]</prefix>
447-
<suffix>-- </suffix>
447+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
448448
</boundary>
449449

450450
<boundary>
@@ -453,7 +453,7 @@ Formats:
453453
<where>1,2</where>
454454
<ptype>2</ptype>
455455
<prefix>' WHERE [RANDNUM]=[RANDNUM]</prefix>
456-
<suffix>-- </suffix>
456+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
457457
</boundary>
458458

459459
<boundary>
@@ -462,7 +462,7 @@ Formats:
462462
<where>1,2</where>
463463
<ptype>4</ptype>
464464
<prefix>" WHERE [RANDNUM]=[RANDNUM]</prefix>
465-
<suffix>-- </suffix>
465+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
466466
</boundary>
467467

468468
<boundary>
@@ -471,7 +471,7 @@ Formats:
471471
<where>1,2</where>
472472
<ptype>1</ptype>
473473
<prefix> WHERE [RANDNUM]=[RANDNUM]</prefix>
474-
<suffix>-- </suffix>
474+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
475475
</boundary>
476476
<!-- End of pre-WHERE generic boundaries -->
477477

@@ -482,7 +482,7 @@ Formats:
482482
<where>1,2</where>
483483
<ptype>2</ptype>
484484
<prefix>')) AS [RANDSTR] WHERE [RANDNUM]=[RANDNUM]</prefix>
485-
<suffix>-- </suffix>
485+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
486486
</boundary>
487487

488488
<boundary>
@@ -491,7 +491,7 @@ Formats:
491491
<where>1,2</where>
492492
<ptype>2</ptype>
493493
<prefix>")) AS [RANDSTR] WHERE [RANDNUM]=[RANDNUM]</prefix>
494-
<suffix>-- </suffix>
494+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
495495
</boundary>
496496

497497
<boundary>
@@ -500,7 +500,7 @@ Formats:
500500
<where>1,2</where>
501501
<ptype>1</ptype>
502502
<prefix>)) AS [RANDSTR] WHERE [RANDNUM]=[RANDNUM]</prefix>
503-
<suffix>-- </suffix>
503+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
504504
</boundary>
505505

506506
<boundary>
@@ -509,7 +509,7 @@ Formats:
509509
<where>1,2</where>
510510
<ptype>2</ptype>
511511
<prefix>') AS [RANDSTR] WHERE [RANDNUM]=[RANDNUM]</prefix>
512-
<suffix>-- </suffix>
512+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
513513
</boundary>
514514

515515
<boundary>
@@ -518,7 +518,7 @@ Formats:
518518
<where>1,2</where>
519519
<ptype>4</ptype>
520520
<prefix>") AS [RANDSTR] WHERE [RANDNUM]=[RANDNUM]</prefix>
521-
<suffix>-- </suffix>
521+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
522522
</boundary>
523523

524524
<boundary>
@@ -527,7 +527,7 @@ Formats:
527527
<where>1,2</where>
528528
<ptype>1</ptype>
529529
<prefix>) AS [RANDSTR] WHERE [RANDNUM]=[RANDNUM]</prefix>
530-
<suffix>-- </suffix>
530+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
531531
</boundary>
532532

533533
<boundary>
@@ -536,7 +536,7 @@ Formats:
536536
<where>1</where>
537537
<ptype>1</ptype>
538538
<prefix>` WHERE [RANDNUM]=[RANDNUM]</prefix>
539-
<suffix>-- </suffix>
539+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
540540
</boundary>
541541

542542
<boundary>
@@ -545,7 +545,7 @@ Formats:
545545
<where>1</where>
546546
<ptype>1</ptype>
547547
<prefix>`) WHERE [RANDNUM]=[RANDNUM]</prefix>
548-
<suffix>-- </suffix>
548+
<suffix>[GENERIC_SQL_COMMENT]</suffix>
549549
</boundary>
550550
<!-- End of pre-WHERE derived table boundaries -->
551551

xml/payloads/01_boolean_blind.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Tag: <test>
212212
<vector>AND [INFERENCE]</vector>
213213
<request>
214214
<payload>AND [RANDNUM]=[RANDNUM]</payload>
215-
<comment>-- -</comment>
215+
<comment>[GENERIC_SQL_COMMENT]</comment>
216216
</request>
217217
<response>
218218
<comparison>AND [RANDNUM]=[RANDNUM1]</comparison>
@@ -229,7 +229,7 @@ Tag: <test>
229229
<vector>OR [INFERENCE]</vector>
230230
<request>
231231
<payload>OR [RANDNUM]=[RANDNUM]</payload>
232-
<comment>-- -</comment>
232+
<comment>[GENERIC_SQL_COMMENT]</comment>
233233
</request>
234234
<response>
235235
<comparison>OR [RANDNUM]=[RANDNUM1]</comparison>
@@ -246,7 +246,7 @@ Tag: <test>
246246
<vector>OR NOT [INFERENCE]</vector>
247247
<request>
248248
<payload>OR NOT [RANDNUM]=[RANDNUM]</payload>
249-
<comment>-- -</comment>
249+
<comment>[GENERIC_SQL_COMMENT]</comment>
250250
</request>
251251
<response>
252252
<comparison>OR NOT [RANDNUM]=[RANDNUM1]</comparison>

xml/payloads/06_union_query.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<vector>[UNION]</vector>
1313
<request>
1414
<payload/>
15-
<comment>-- -</comment>
15+
<comment>[GENERIC_SQL_COMMENT]</comment>
1616
<char>[CHAR]</char>
1717
<columns>[COLSTART]-[COLSTOP]</columns>
1818
</request>
@@ -31,7 +31,7 @@
3131
<vector>[UNION]</vector>
3232
<request>
3333
<payload/>
34-
<comment>-- -</comment>
34+
<comment>[GENERIC_SQL_COMMENT]</comment>
3535
<char>NULL</char>
3636
<columns>[COLSTART]-[COLSTOP]</columns>
3737
</request>
@@ -50,7 +50,7 @@
5050
<vector>[UNION]</vector>
5151
<request>
5252
<payload/>
53-
<comment>-- -</comment>
53+
<comment>[GENERIC_SQL_COMMENT]</comment>
5454
<char>[RANDNUM]</char>
5555
<columns>[COLSTART]-[COLSTOP]</columns>
5656
</request>
@@ -69,7 +69,7 @@
6969
<vector>[UNION]</vector>
7070
<request>
7171
<payload/>
72-
<comment>-- -</comment>
72+
<comment>[GENERIC_SQL_COMMENT]</comment>
7373
<char>[CHAR]</char>
7474
<columns>1-10</columns>
7575
</request>
@@ -88,7 +88,7 @@
8888
<vector>[UNION]</vector>
8989
<request>
9090
<payload/>
91-
<comment>-- -</comment>
91+
<comment>[GENERIC_SQL_COMMENT]</comment>
9292
<char>NULL</char>
9393
<columns>1-10</columns>
9494
</request>
@@ -107,7 +107,7 @@
107107
<vector>[UNION]</vector>
108108
<request>
109109
<payload/>
110-
<comment>-- -</comment>
110+
<comment>[GENERIC_SQL_COMMENT]</comment>
111111
<char>[RANDNUM]</char>
112112
<columns>1-10</columns>
113113
</request>
@@ -126,7 +126,7 @@
126126
<vector>[UNION]</vector>
127127
<request>
128128
<payload/>
129-
<comment>-- -</comment>
129+
<comment>[GENERIC_SQL_COMMENT]</comment>
130130
<char>[CHAR]</char>
131131
<columns>11-20</columns>
132132
</request>
@@ -145,7 +145,7 @@
145145
<vector>[UNION]</vector>
146146
<request>
147147
<payload/>
148-
<comment>-- -</comment>
148+
<comment>[GENERIC_SQL_COMMENT]</comment>
149149
<char>NULL</char>
150150
<columns>11-20</columns>
151151
</request>
@@ -164,7 +164,7 @@
164164
<vector>[UNION]</vector>
165165
<request>
166166
<payload/>
167-
<comment>-- -</comment>
167+
<comment>[GENERIC_SQL_COMMENT]</comment>
168168
<char>[RANDNUM]</char>
169169
<columns>11-20</columns>
170170
</request>
@@ -183,7 +183,7 @@
183183
<vector>[UNION]</vector>
184184
<request>
185185
<payload/>
186-
<comment>-- -</comment>
186+
<comment>[GENERIC_SQL_COMMENT]</comment>
187187
<char>[CHAR]</char>
188188
<columns>21-30</columns>
189189
</request>
@@ -202,7 +202,7 @@
202202
<vector>[UNION]</vector>
203203
<request>
204204
<payload/>
205-
<comment>-- -</comment>
205+
<comment>[GENERIC_SQL_COMMENT]</comment>
206206
<char>NULL</char>
207207
<columns>21-30</columns>
208208
</request>
@@ -221,7 +221,7 @@
221221
<vector>[UNION]</vector>
222222
<request>
223223
<payload/>
224-
<comment>-- -</comment>
224+
<comment>[GENERIC_SQL_COMMENT]</comment>
225225
<char>[RANDNUM]</char>
226226
<columns>21-30</columns>
227227
</request>
@@ -240,7 +240,7 @@
240240
<vector>[UNION]</vector>
241241
<request>
242242
<payload/>
243-
<comment>-- -</comment>
243+
<comment>[GENERIC_SQL_COMMENT]</comment>
244244
<char>[CHAR]</char>
245245
<columns>31-40</columns>
246246
</request>
@@ -259,7 +259,7 @@
259259
<vector>[UNION]</vector>
260260
<request>
261261
<payload/>
262-
<comment>-- -</comment>
262+
<comment>[GENERIC_SQL_COMMENT]</comment>
263263
<char>NULL</char>
264264
<columns>31-40</columns>
265265
</request>
@@ -278,7 +278,7 @@
278278
<vector>[UNION]</vector>
279279
<request>
280280
<payload/>
281-
<comment>-- -</comment>
281+
<comment>[GENERIC_SQL_COMMENT]</comment>
282282
<char>[RANDNUM]</char>
283283
<columns>31-40</columns>
284284
</request>
@@ -297,7 +297,7 @@
297297
<vector>[UNION]</vector>
298298
<request>
299299
<payload/>
300-
<comment>-- -</comment>
300+
<comment>[GENERIC_SQL_COMMENT]</comment>
301301
<char>[CHAR]</char>
302302
<columns>41-50</columns>
303303
</request>
@@ -315,7 +315,7 @@
315315
<vector>[UNION]</vector>
316316
<request>
317317
<payload/>
318-
<comment>-- -</comment>
318+
<comment>[GENERIC_SQL_COMMENT]</comment>
319319
<char>NULL</char>
320320
<columns>41-50</columns>
321321
</request>
@@ -334,7 +334,7 @@
334334
<vector>[UNION]</vector>
335335
<request>
336336
<payload/>
337-
<comment>-- -</comment>
337+
<comment>[GENERIC_SQL_COMMENT]</comment>
338338
<char>[RANDNUM]</char>
339339
<columns>41-50</columns>
340340
</request>

0 commit comments

Comments
 (0)