-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
ALEPH-2018004 - DOS vulnerability is still exploitable #3010
Comments
Scratch my former comment (which i deleted). Makes sense to classify this also as a potential exploit for DOS if the attacker finds ways for the affected app/service to on-board deeply nested data that the app/service is then going to json-serialize down the road... |
Deserializing in a web api means deserializing what JSON you’re given. Protection is needed in that direction to prevent JSON from impacting the availability of your app. Serializing outbound JSON is controlled by the app because your app code controls the object being serialized. You should take steps not to give the serializer a bad type. Throwing a StackoverflowException by itself isn’t a vulnerability. The exploit was that an external attacker could trigger it by sending a web api JSON. |
An infrastructure library that throws StackoverflowException exception (which cannot be caught and terminate the process) is a potential risk to applications that use it. |
The bug is the user didn't validate the depth of the input: the expression tree.
|
I disagree with this approach.
DataContractJsonSerializer Its an old library and it is not part of System.Text.Json. |
The fix that was applied for the DOS vulnerability in Newtonsoft.Json 13.0.1 (#2462) does not really solve the problem.
It fixes only one potential way to create an highly nested object that will throw a StackOverflowException (Deserialize a given serialized object).
But what if the system contains nested objects like file system structure or groups that can contain sub-groups?
An attacker can create highly nested object in the system, and then whenever this object will be serialized, it will initiate a fatal StuckOverflowException.
Expected behavior
The recursion depth should be limited by default also for the Serialization functions (like JsonSerializer.Serialize(..)).
Actually, all the recursive functions should be limited by default to prevent potential DOS attacks.
Actual behavior
Recursion depth is not limited by default in the Serialization functions.
Sample code that demopnstrates the issue
The text was updated successfully, but these errors were encountered: