-
Notifications
You must be signed in to change notification settings - Fork 65
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
Stack overflow error caused by genson parsing of untrusted JSON String #191
Comments
Hey! Thank you for the detailed issue and proposer solutions. I'm not maintaining Genson anymore. If you would like to propose a PR that would be more than welcome. I could then release it. |
@EugenCepoi So Genson is no longer be maintained? |
Hi @pcgeng , indeed, I decided to stop investing time in it, no new features or bug fixes from my side. But as I mention if folks want to contribute, it will then be maintained and I can invest some time in reviewing designs/code and doing releases. |
This adds a quick and dirty guard against a stack overflow condition when deserializing severely nested data.
This adds a quick and dirty guard against a stack overflow condition when serializing and deserializing severely nested data.
Stack overflow error caused by genson parsing of untrusted JSON String
Description
Using genson to parse untrusted JSON String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow.
Error Log
PoC
Rectification Solution
Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (FasterXML/jackson-databind@fcfc499)
Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((google/gson@2d01d6a20f39881c692977564c1ea591d9f39027))
The text was updated successfully, but these errors were encountered: