Report ID
#33411
Report type
Smart Contract
Has PoC?
Yes
Target
https://etherscan.io/address/0x39cdAf9Dc6057Fd7Ae81Aaed64D7A062aAf452fD
Impacts
Collisions can lead to unauthorized actions.
Description
This compact encoding can lead to collisions where different sets of input data produce the same encoded byte sequence. This can cause issues in situations where unique identifiers or hashes are expected, leading to unexpected behavior.
Vulnerability Details
Internalizer.uri(uint256) (contracts/fertilizer/Internalizer.sol#41-43) calls abi.encodePacked() with multiple dynamic arguments: - string(abi.encodePacked(_uri,StringsUpgradeable.toString(_id))) (contracts/fertilizer/Internalizer.sol#42)
Impact Details
Description: Detect collision due to dynamic type usages in abi.encodePacked
Exploit Scenario:
contract Sign { function get_hash_for_signature(string name, string doc) external returns(bytes32) { return keccak256(abi.encodePacked(name, doc)); } } Bob calls get_hash_for_signature with (bob, This is the content). The hash returned is used as an ID. Eve creates a collision with the ID using (bo, bThis is the content) and compromises the system.
Recommendation: Do not use more than one dynamic type in abi.encodePacked() (see the Solidity documentation). Use abi.encode(), preferably.
References
https://docs.soliditylang.org/en/v0.5.10/abi-spec.html?highlight=abi.encodePacked#non-standard-packed-modeDynamic