pwn0sec / PwnXSS

PwnXSS: Vulnerability (XSS) scanner exploit
MIT License
738 stars 137 forks source link

Documentation for cookies is wrong #27

Open SimonSchoeni opened 2 years ago

SimonSchoeni commented 2 years ago

Your cookie support works fine! However the documentation you provide in your documentation is wrong. If one follows your documenation they will run into an error with the json parser.

To Reproduce If i run python3 -u myhost.com --cookie {'ID':'1094200543'}

you will run into the following error:

Traceback (most recent call last):                                                                                                                                                  
  File "/home/kali/Desktop/MasterTools/PwnXSS/pwnxss.py", line 73, in <module>                                                                                                      
    start()                                                                                                                                                                         
  File "/home/kali/Desktop/MasterTools/PwnXSS/pwnxss.py", line 52, in start                                                                                                         
    core.main(getopt.u,getopt.proxy,getopt.user_agent,check(getopt),getopt.cookie,getopt.method)                                                                                    
  File "/home/kali/Desktop/MasterTools/PwnXSS/lib/core.py", line 163, in main                                                                                                       
    self.session=session(proxy,headers,cookie)                                                                                                                                      
  File "/home/kali/Desktop/MasterTools/PwnXSS/lib/helper/helper.py", line 26, in session                                                                                            
    r.cookies.update(json.loads(cookie))                                                                                                                                            
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads                                                                                                                    
    return _default_decoder.decode(s)                                                                                                                                               
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode                                                                                                                    
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())                                                                                                                               
  File "/usr/lib/python3.9/json/decoder.py", line 353, in raw_decode                                                                                                                
    obj, end = self.scan_once(s, idx)                                                                                                                                               
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)   

which is completely fine since the Json parser requires properties in double quotes. Single quotes are not valid. Furthermore the json parser requires a string to be passed. Your documentation guides the user into providing the json object itself which is off.

When changing the request to actually take the functionallity of the parser into account the request works. python3 pwnxss.py -u myhost.com --cookie "{\"ID\":\"1094200543\"}" Expected behavior There are two possibilities how you could fix this.