abi.encodePacked Collision
Two different sets of arguments that produce the same bytes, and therefore the same hash, because Solidity's abi.encodePacked concatenates variable-length fields without their lengths.
abi.encodePacked writes its arguments back to back in the tightest form, with no padding for short types and no length prefix for dynamic ones such as bytes, string and arrays. When two or more of those arguments are variable-length, the boundary between them is not part of the output. ("ab", "c") and ("a", "bc") pack to the same bytes.
That becomes a vulnerability whenever the packed result is hashed and then signed or compared. A signature over one set of fields also validates every other set that packs to the same bytes. In a cross-chain adapter that receives amount and recipient as raw bytes, an attacker can move bytes from one field into the other: in July 2026, an authorization for about 3,110 tokens was turned into a release of more than 203M this way.
The fix is to hash with boundaries. abi.encode stores each dynamic field with its length, so no bytes can move between fields, and EIP-712 typed data gives signed messages the same property along with domain separation. abi.encodePacked remains safe when every argument has a fixed size, or when there is at most one dynamic argument.
Related Terms
EIP-712
Ethereum standard for structured data hashing and signing enabling human-readable transaction signatures with domain separation.
Replay Attack
An attack where a valid transaction or message is maliciously resubmitted to execute the same action multiple times.
Cross-Chain
Technology enabling interoperability and asset transfers between different blockchain networks.
Nonce
A random number used once in cryptographic operations, critical for ECDSA signature security and preventing replay attacks.
Need expert guidance on abi.encodePacked Collision?
Our team at Zealynx has deep expertise in blockchain security and DeFi protocols. Whether you need an audit or consultation, we're here to help.
Get a Quote