CVE-2021-34371
About
Neo4j through 3.4.18 (with the shell server enabled) exposes an RMI service that arbitrarily deserializes Java objects, e.g., through setSessionVariable. An attacker can abuse this for remote code execution because there are dependencies with exploitable gadget chains.
Rainforest analyst review
Neo4j with the shell server enabled exposes an RMI service that will deserialize arbitrary Java objects it's handed, for instance through setSessionVariable. That's the classic unsafe-deserialization trap: because exploitable gadget chains exist in the dependencies, an attacker who can reach the RMI port sends a crafted serialized payload and gets remote code execution on the database host. Unauthenticated, remote, no interaction — the deserialization is the whole exploit.
Java deserialization bugs are a mature, well-tooled attack class; ready-made gadget-chain payloads exist and get reused, so weaponization is fast once a reachable listener is found. The critical precondition, and it's a real one, is that the shell server has to be enabled and its RMI port reachable. That narrows exposure considerably — many deployments don't run it — but any instance that does, with the port on an accessible network, is a straightforward RCE target for anyone scanning for exposed RMI services.
For us this is a reachability-and-configuration hunt more than a version sweep. We'd identify Neo4j instances at or below 3.4.18, then check the two things that actually gate it: is the shell server enabled, and is that RMI port exposed beyond localhost or a trusted segment? An exposed listener is an emergency; a disabled shell server or a firewalled port drops the same version far down the list. Blocking the RMI port is an immediate virtual-patch where upgrading lags.
References
Related CVEs
Frequently asked questions
What is CVE-2021-34371?
Neo4j through 3.4.18 (with the shell server enabled) exposes an RMI service that arbitrarily deserializes Java objects, e.g., through setSessionVariable. An attacker can abuse this for remote code execution because there are dependencies with exploitable gadget chains.
How severe is CVE-2021-34371?
CVE-2021-34371 carries a CVSS 3.1 base score of 9.8, rated critical. On the Rainforest Risk Index — which weighs the severity alongside how easy the flaw is to reach and how broad its impact is — it scores 99 out of 100, in the critical band.
How is CVE-2021-34371 exploited?
According to the CVSS vector (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H): attack vector Network, attack complexity Low, privileges required None, user interaction None. Impact on confidentiality High, integrity High and availability High.
Which products are affected by CVE-2021-34371?
Public advisories list the following as affected: neo4j. Check the references on this page for the exact versions each vendor confirms.
How do I fix CVE-2021-34371?
Apply the fix the vendor published — the references on this page link to the primary advisories and patches. When patching can't happen right away, reduce the exposure of the affected component and watch it for exploitation attempts. Rainforest customers see this vulnerability correlated to their own assets and prioritized by real exposure, not by score alone.
Empower Your Security Strategy with Rainforest
Discover vulnerabilities early, prioritize critical threats, and protect what truly matters. Rainforest streamlines your security operations, saving you time and reducing costs, so you can focus on what drives your business forward.
