question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optimize `UntypedObjectDeserializer` wrt recursion [CVE-2020-36518]

See original GitHub issue

EDIT: related to to CVE-2020-36518 (see https://nvd.nist.gov/vuln/detail/CVE-2020-36518)

EDIT: Fix included in

EDIT: included as one of Snyk’s “top-10 vulns of 2022” CVEs – see https://go.snyk.io/snyk-top-10-open-source-vulnerabilities-dwn-typ.html


Current implementation UntypedObjectDeserializer is relatively expensive for deeply nested Object and Array values as it uses recursion even for “vanilla” case (one where there are no custom List/array or Map deserializers). In practical terms it is possible to exhaust typical modest JVM memory with documents having about ten thousand levels of nestings, due to size of call stack from recursive calls.

NOTE: specifically this ONLY APPLIES if the target type is “untyped” or generic Collection<Object> / Map<String, Object> – it DOES NOT APPLY to cases where target is POJO (except if POJO itself has “untyped” property or properties).

Similar issue was already solved wrt JsonNode (see #3397), included in 2.13.0; this might show a way to approach this problem: by replacing simple recursion with iteration, either completely or at some inner levels.

Also note that it may ultimately be necessary to have lower-level constraints for streaming parser too, see: https://github.com/FasterXML/jackson-core/issues/637

Ideally it should be:

  1. Possible to handle at least tens of thousands of levels of nesting (100k should be processable with 256M heap, say)
  2. Have streaming level limits that – by default – block documents with more than limit we deem safe (less than 100k – perhaps 10k or something, to be determined).

This issue is specifically about (1) as (2) is about jackson-core.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:77 (42 by maintainers)

github_iconTop GitHub Comments

75reactions
cowtowncodercommented, Mar 15, 2022

Oh fucking great. Someone decided to file an CVE for this one.

Surely teaches me to file issues on things I want to work on – and then some Very Nice Person going to file an CVE to freak out everybody.

60reactions
cowtowncodercommented, Mar 23, 2022

@Syed-Shahul-Hameed more that I have to spend time on answering this question slower the release is. As soon as I find time – this is a non-paid voluntary activity for me, alongside a real job and family – I will make a release.

In the meantime I just hope users will eventually push back on security tool vendors that cause all of this stress and fake alarm: Security Circus at its worst. This wrt general applicability – there is an actual potential problem, for some users and usage. But not an immediate generally applicable wide-scale thing like remote execution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CVE-2020-36518
CVE-2020-36518 is a disclosure identifier tied to a security ... Optimize `UntypedObjectDeserializer` wrt recursion · Issue #2816 ...
Read more >
Security update for jackson-databind, jackson ... - SUSE
CVE-2020-36518 : Fixed a Java stack overflow exception and denial of service via a large depth of nested objects in jackson-databind.
Read more >
subject:"commit jackson\-databind for openSUSE\:Factory"
... (24-Mar-2022) ++ #2816: Optimize UntypedObjectDeserializer wrt recursion ++ ... Update to 2.13.0 +- Update to 2.13.0 (CVE-2020-36518, bsc#1197132) Other ...
Read more >
SUSE alert SUSE-SU-2022:1678-1 (jackson-databind ...
+ Optimize array allocation by 'JsonStringEncoder' + Add 'mvnw' wrapper ... '_arrayDelegateDeserializer') + UntypedObjectDeserializer' mixes ...
Read more >
Guilherme Biff Zarelli on Twitter: "Galera do Java, quem utiliza ...
Optimize `UntypedObjectDeserializer` wrt recursion [CVE-2020-36518] · Issue #2816 · FasterXML/jac... EDIT: related to to CVE-2020-36518 (see ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found