0x3adeade - `initializeERC721Bridgable()` && `initializeERC1155Bridgable()` function in **moongate/src/InfernalRiftBelow.sol** can be set by anyone due to lack of access control. #634
initializeERC721Bridgable() && initializeERC1155Bridgable() function in moongate/src/InfernalRiftBelow.sol can be set by anyone due to lack of access control.
Summary
InfernalRiftBelow contract is intended to be deployed on L2 and facilitate token transfer and it uses initializeERC1155Bridgable() and initializeERC721Bridgable() functions to set implementations for the repective standards.
However this function lacks access control and can be set by anyone as long as ERC721_BRIDGABLE_IMPLEMENTATION isaddress(0) and ERC1155_BRIDGABLE_IMPLEMENTATION is address(0).
So an attacker would be able to set any arbitrary address and can potentailly introduce backdoors.
This also exposes function to the risk of frontrunning where malicious address can be set before legitimate one.
0x3adeade
Medium
initializeERC721Bridgable()
&&initializeERC1155Bridgable()
function in moongate/src/InfernalRiftBelow.sol can be set by anyone due to lack of access control.Summary
InfernalRiftBelow contract is intended to be deployed on L2 and facilitate token transfer and it uses
initializeERC1155Bridgable()
andinitializeERC721Bridgable()
functions to set implementations for the repective standards. However this function lacks access control and can be set by anyone as long asERC721_BRIDGABLE_IMPLEMENTATION
isaddress(0)
andERC1155_BRIDGABLE_IMPLEMENTATION
isaddress(0)
. So an attacker would be able to set any arbitrary address and can potentailly introduce backdoors. This also exposes function to the risk of frontrunning where malicious address can be set before legitimate one.Root Cause
Lack of access control in
initializeERC721Bridgable()
&&initializeERC1155Bridgable()
. https://github.com/sherlock-audit/2024-08-flayer/blob/main/moongate/src/InfernalRiftBelow.sol#L103-L126Internal pre-conditions
ERC721_BRIDGABLE_IMPLEMENTATION
isaddress(0)
ERC1155_BRIDGABLE_IMPLEMENTATION
isaddress(0)
External pre-conditions
No response
Attack Path
ERC721_BRIDGABLE_IMPLEMENTATION
isaddress(0)
andERC1155_BRIDGABLE_IMPLEMENTATION
isaddress(0)
after InfernalRiftbelow contract is deployed.initializeERC721Bridgable()
andinitializeERC1155Bridgable()
before contract owner and this value can no longer be changed.Impact
Addresses set by an Attacker can be malicious and implement backdoors into theselibraries and would potentially require redployment.
PoC
No response
Mitigation
Implement access control such that only trusted admin can call
initializeERC721Bridgable()
andinitializeERC1155Bridgable()
functions.