Elixir-protobuf protobuf
Uncontrolled recursion in elixir-protobuf/protobuf JSON decoding of self-referential messages
Uncontrolled Recursion vulnerability in Protobuf.JSON.Decode in elixir-protobuf protobuf allows an unauthenticated remote attacker to crash the decoding process via a deeply nested JSON document. Any application that decodes attacker-supplied JSON with Protobuf.JSON.decode/3, Protobuf.JSON.decode!/3, or Protobuf.JSON.from_decoded/3 into a schema that contains a self-referential or cyclic message type is affected. In lib/protobuf/json/decode.ex, the embedded-message clause of decode_singular/3 recurses into internal_from_json_data/3 once per nesting level without incrementing or checking the decoder's depth counter. The depth guard increase_depth_and_maybe_throw/1 covers only the Google.Protobuf.ListValue and Google.Protobuf.Struct clauses, so the recursion_limit option has no effect on user-defined message types. Each nesting level allocates a stack frame and heap objects, and a sufficiently deep document exhausts the memory of the decoding process. Confidentiality and integrity are not affected. This issue affects protobuf: from 0.8.0 before 0.17.1.
Affected versions and mitigation
From the CVE record and the vendor's references.Affected
- >= 0.8.0, < 0.17.1
Fixed in 0.17.1
- >= b0a1d4eaffaf50012fa71a8e931a47cf252d0370, < e9432ad1c4099511905353cebcececa3a1f7c3ff
Fixed in e9432ad1c4099511905353cebcececa3a1f7c3ff
Mitigation
Upgrade protobuf to 0.17.1 or later.
Upgrade protobuf to e9432ad1c4099511905353cebcececa3a1f7c3ff or later.
Workaround
Reject JSON documents whose nesting depth exceeds a fixed bound at the web or middleware layer before passing them to the decoder. No decoder option limits recursion for user-defined message types, so the check must happen before Protobuf.JSON.decode/3, Protobuf.JSON.decode!/3, or Protobuf.JSON.from_decoded/3 is called.
References
Timeline
Days relative to CVE publicationNo public PoC found yet; not in CISA KEV.
PoC repositories
Found on GitHub.No PoC repositories found yet.