Closed c4-bot-5 closed 11 months ago
https://github.com/code-423n4/2023-11-panoptic/blob/main/contracts/libraries/PanopticMath.sol#L38
The method generates a pool ID from hashing parameters without collision checks.
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
This modified version alters the method of concatenation and hash derivation, potentially reducing the risk of hash collisions
function getFinalPoolId( uint64 basePoolId, address token0, address token1, uint24 fee ) internal pure returns (uint64) { bytes memory poolIdData = abi.encodePacked(token0, token1, fee); bytes32 hash = keccak256(poolIdData); uint64 finalPoolId = basePoolId + (uint64(hash) >> 32); return finalPoolId; }
Other
Picodes marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-11-panoptic/blob/main/contracts/libraries/PanopticMath.sol#L38
Vulnerability details
Impact
The method generates a pool ID from hashing parameters without collision checks.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Tools Used
Recommended Mitigation Steps
This modified version alters the method of concatenation and hash derivation, potentially reducing the risk of hash collisions
function getFinalPoolId( uint64 basePoolId, address token0, address token1, uint24 fee ) internal pure returns (uint64) { bytes memory poolIdData = abi.encodePacked(token0, token1, fee); bytes32 hash = keccak256(poolIdData); uint64 finalPoolId = basePoolId + (uint64(hash) >> 32); return finalPoolId; }
Assessed type
Other