Skip to content

Fix duplicate paramDict elements bug - #3917

Closed
phant0ms wants to merge 1 commit into
sqlmapproject:masterfrom
phant0ms:master
Closed

Fix duplicate paramDict elements bug#3917
phant0ms wants to merge 1 commit into
sqlmapproject:masterfrom
phant0ms:master

Conversation

@phant0ms

Copy link
Copy Markdown

sqlmap parse some json may generate duplicated paramDict elements

for example, when sqlmap parse a json data:

{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}

the conf.paramDict['POST'] value will is:

'JSON #1*' (90737040) = {unicode} u'{"employees":[{"firstName*":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #2*' (70483568) = {unicode} u'{"employees":[{"firstName":"Bill*","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #3*' (90737472) = {unicode} u'{"employees":[{"firstName":"Bill*","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #4*' (90737136) = {unicode} u'{"employees":[{"firstName":"Bill","lastName*":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #5*' (90737232) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates*"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #6*' (90737184) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates*"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #7*' (90737280) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName*":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #8*' (90737328) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George*","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #9*' (90737376) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George*","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #10*' (90737424) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName*":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #11*' (90737520) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush*"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #12*' (90737568) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush*"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #13*' (90737616) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName*":"Thomas","lastName":"Carter"}]}'
'JSON #14*' (90737664) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas*","lastName":"Carter"}]}'
'JSON #15*' (90737712) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas*","lastName":"Carter"}]}'
'JSON #16*' (90737760) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName*":"Carter"}]}'
'JSON #17*' (90737808) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter*"}]}'
'JSON #18*' (90737856) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter*"}]}'

for example : the JSON #17 same with JSON #18.

there should be only have JSON #12, so it generated six duplicate elements.

one of the two adjacent data is duplicated. The reason for generating duplicate data is that there is a null value when split data use parts = kb.customInjectionMark), so we should need remove null value

the fixed result:

'JSON #1*' (90979760) = {unicode} u'{"employees":[{"firstName*":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #2*' (91152576) = {unicode} u'{"employees":[{"firstName":"Bill*","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #3*' (91152672) = {unicode} u'{"employees":[{"firstName":"Bill","lastName*":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #4*' (91152528) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates*"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #5*' (91152624) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName*":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #6*' (91152720) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George*","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #7*' (91152768) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName*":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #8*' (91152816) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush*"},{"firstName":"Thomas","lastName":"Carter"}]}'
'JSON #9*' (91152864) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName*":"Thomas","lastName":"Carter"}]}'
'JSON #10*' (91152912) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas*","lastName":"Carter"}]}'
'JSON #11*' (91152960) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName*":"Carter"}]}'
'JSON #12*' (91153008) = {unicode} u'{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter*"}]}'

@stamparm stamparm closed this in e8871b8 Sep 12, 2019
@stamparm

Copy link
Copy Markdown
Member

Bug had to be "patched" at the source of the problem, hence the latest commit. Anyway, @phant0ms thank you for your report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants