CVE-2026-104635: Uncontrolled Recursion in elixir-protobuf Package JSON Decoding
Summary
CVE-2026-104635: Uncontrolled recursion in elixir-protobuf/protobuf JSON decoding of self-referential messages. Affects protobuf across 2 version ranges.
>= 0.8.0, < 0.17.1
>= b0a1d4eaffaf50012fa71a8e931a47cf252d0370, < e9432ad1c4099511905353cebcececa3a1f7c3ff
Fixed in 0.17.1. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The elixir-protobuf package is a library for encoding and decoding Protocol Buffers (protobuf) in Elixir applications. It allows developers to serialize structured data efficiently. However, this package is vulnerable to an uncontrolled recursion issue during JSON decoding, particularly when handling self-referential message types, which can lead to significant memory exhaustion and application crashes.
Vulnerability Detail
The vulnerability arises from the Protobuf.JSON.Decode module, which fails to guard against uncontrolled recursion when decoding deeply nested JSON documents. Specifically, the decoding process does not properly track the depth of recursion for user-defined message types, allowing an attacker to craft a JSON document that can recursively reference itself. This can lead to stack and heap exhaustion, causing the decoding process to crash. The vulnerability affects versions of the protobuf package from 0.8.0 to below 0.17.1, and it can be exploited by unauthenticated remote attackers.
How To Fix
Minimum fixed version
0.17.1
This is the first release that contains the fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, reject JSON documents with a nesting depth that exceeds a predefined limit at the web or middleware layer before passing them to the decoder. For example, you can implement a check like this in your application:
def validate_json_depth(json, max_depth) do
depth = calculate_depth(json)
if depth > max_depth do
{:error, :depth_exceeded}
else
:ok
end
end
defp calculate_depth(value, depth \ 0) do
case value do
%{} ->
Enum.reduce(value, depth + 1, fn {_key, val}, acc ->
calculate_depth(val, acc)
end)
_ ->
depth
end
end
Conclusion
CVE-2026-104635 represents a significant risk for applications using the elixir-protobuf package due to uncontrolled recursion during JSON decoding. It is crucial to update to the patched version or implement workarounds to mitigate the risk of application crashes.
See every vulnerability recorded for protobuf →
FAQ
CVE-2026-104635 is a vulnerability in the elixir-protobuf package that allows for uncontrolled recursion during JSON decoding, potentially leading to application crashes.
You can check if your application is affected by using Vulert, which monitors and alerts for open-source vulnerabilities. You can access the Vulert playground at Vulert Scanner without any signup.
The vulnerability affects elixir-protobuf versions from 0.8.0 to below 0.17.1.
If you cannot update the package right away, implement a workaround by rejecting deeply nested JSON documents at the web or middleware layer.
The CVSS score of this vulnerability is 8.2, indicating a high severity level.
Related vulnerabilities
Recent vulnerabilities recorded for protobuf.
Follow Vulert in Google
Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.