JSshell icon indicating copy to clipboard operation
JSshell copied to clipboard

Large number of cookies exceeding the defined buffer size can crash the script

Open shiblisec opened this issue 2 years ago • 2 comments

I recently discovered that if a target has a large number of cookies the script doesn't handle it well and starts crashing. for instance, if an app has the following cookies set.

image

and if the client is listening to a connection on JSshell, the moment the target will send a large number of cookies the script will restart, refer to the below screenshot.

image

The reason why the above behavior is happening is because of the following lines of code.

 try:
        c, addr = s.accept()
        resp = c.recv(1024).decode()
    except KeyboardInterrupt:
        if sys.platform == 'win32':
                print('\nControl-C')
        exit()
    except:
        s.close()
        main()

In the above code, the buffer size for c.recv is hard coded to the value of 1024 so if a response is received that is greater than the buffer size the application throws an exception and starts the main() function again.

To tackle this problem I have introduced -b flag using which users can provide a custom buffer size if the target application is storing a large number of cookies.

shiblisec avatar Dec 20 '22 12:12 shiblisec

It's still not working

image

The reason for this could be different payload lengths, 1024 defines the max buffer size it does not define the starting and ending point of a payload.

shiblisec avatar Dec 20 '22 14:12 shiblisec

1024 defines the max buffer size it does not define the starting and ending point of a payload.

I know, but after the buffer is fully received, b in the next round will become an empty string and therefore the loop should break

shelld3v avatar Dec 20 '22 14:12 shelld3v