Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

shiblisec
Copy link
Contributor

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
Copy link
Contributor Author

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.

@shelld3v
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants