createAttestation: Hash collision due to abi.encodePacked
Summary
createAttestation uses the functions: _keccakForCreateAttestation and getServiceAndAccountHash, which both apply keccak256 to abi.encodePacked output. Both functions accept strings as their input parameters, as such when abi.encodePacked concatenates them, there is an ambiguity where one string ends and starts.
Boy2000
High
createAttestation: Hash collision due to abi.encodePacked
Summary
createAttestation
uses the functions:_keccakForCreateAttestation
andgetServiceAndAccountHash
, which both applykeccak256
toabi.encodePacked
output. Both functions accept strings as their input parameters, as such whenabi.encodePacked
concatenates them, there is an ambiguity where one string ends and starts.Root Cause
https://github.com/sherlock-audit/2024-10-ethos-network/blob/main/ethos/packages/contracts/contracts/EthosAttestation.sol#L521
Thus it is possible to "move" the string values, while still generating the same hash output (and same valid
signature
)Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
PoC
Mitigation
Use
abi.encode
.