VYPR
Moderate severityNVD Advisory· Published Jun 16, 2023· Updated Dec 16, 2024

OpenZeppelin Contracts's MerkleProof multiproofs may allow proving arbitrary leaves for specific trees

CVE-2023-34459

Description

OpenZeppelin Contracts is a library for smart contract development. Starting in version 4.7.0 and prior to version 4.9.2, when the verifyMultiProof, verifyMultiProofCalldata, procesprocessMultiProof, or processMultiProofCalldat functions are in use, it is possible to construct merkle trees that allow forging a valid multiproof for an arbitrary set of leaves.

A contract may be vulnerable if it uses multiproofs for verification and the merkle tree that is processed includes a node with value 0 at depth 1 (just under the root). This could happen inadvertedly for balanced trees with 3 leaves or less, if the leaves are not hashed. This could happen deliberately if a malicious tree builder includes such a node in the tree.

A contract is not vulnerable if it uses single-leaf proving (verify, verifyCalldata, processProof, or processProofCalldata), or if it uses multiproofs with a known tree that has hashed leaves. Standard merkle trees produced or validated with the @openzeppelin/merkle-tree library are safe.

The problem has been patched in version 4.9.2.

Some workarounds are available. For those using multiproofs: When constructing merkle trees hash the leaves and do not insert empty nodes in your trees. Using the @openzeppelin/merkle-tree package eliminates this issue. Do not accept user-provided merkle roots without reconstructing at least the first level of the tree. Verify the merkle tree structure by reconstructing it from the leaves.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

OpenZeppelin Contracts multiproof verification before 4.9.2 allows forging proofs for arbitrary leaves if the tree contains a zero node at depth 1.

The vulnerability affects the verifyMultiProof, verifyMultiProofCalldata, processMultiProof, and processMultiProofCalldata functions in OpenZeppelin Contracts versions 4.7.0 to 4.9.1. It arises when the Merkle tree contains a node with value 0 at depth 1 (just under the root), which can occur inadvertently in trees with 3 or fewer unhashed leaves, or deliberately by a malicious tree builder [1].

Exploitation requires the contract to use multiproof verification and the tree to include such a zero node. Single-leaf proving functions are not affected. Standard trees produced by the @openzeppelin/merkle-tree library are safe [1].

An attacker can craft a valid multiproof for an arbitrary set of leaves, bypassing intended verification logic and potentially leading to unauthorized actions in the contract [1].

The issue is patched in version 4.9.2 [4]. Workarounds include hashing leaves, avoiding empty nodes, using the @openzeppelin/merkle-tree package, and not accepting user-provided Merkle roots without reconstructing the first level [1]. The fix commit adds additional validity checks [3].

AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
@openzeppelin/contractsnpm
>= 4.7.0, < 4.9.24.9.2
@openzeppelin/contracts-upgradeablenpm
>= 4.7.0, < 4.9.24.9.2

Affected products

3

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

5

News mentions

0

No linked articles in our index yet.