Fix: crash when using --json without --data on URLs without query params - #439
Open
xyaz1313 wants to merge 1 commit into
Open
Fix: crash when using --json without --data on URLs without query params#439xyaz1313 wants to merge 1 commit into
xyaz1313 wants to merge 1 commit into
Conversation
When running XSStrike with --json flag against a URL without query parameters (e.g., python xsstrike.py -u https://example.net --json), the tool crashes with: AttributeError: 'str' object has no attribute 'keys' This happens because converter(None) returns the string "null", which getParams() then assigns directly to params when jsonData is set. The fix: only call converter() when paramData is actually provided. Fixes s0md3v#438
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When running XSStrike with
--jsonflag against a URL without query parameters, the tool crashes with:Reproduction:
Root Cause
In
xsstrike.pyline 141-143:When
paramDataisNoneandjsonDataisTrue:converter(None)callsjson.dumps(None)→ returns"null"(a string)getParams()seesjsonDatais set, doesparams = data→params = "null"scan()line 53:list(params.keys())[0]→ crashes because strings don't have.keys()Fix
Only convert
paramDatawhen it's actually provided:This way, when
--jsonis used without--data,paramDatastaysNone,getParams()correctly returnsNone, and the "No parameters to test" error message is shown gracefully.Fixes #438