code-423n4 / 2022-07-axelar-findings

0 stars 0 forks source link

Anyone can self-destruct this contract. #212

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Lines of code

https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/DepositHandler.sol#L28-L29

Vulnerability details

Impact

High Unprotected call to a function executing selfdestruct/suicide.

Proof of Concept

DepositHandler.destroy(address) (contracts/DepositHandler.sol#28-30) allows anyone to destruct the contract.

Once the contract is unlocked through the noReenter modifier, anyone can self-destruct this contract.

Tools Used

VIM

Recommended Mitigation Steps

Protect access to all sensitive functions. You can use a modifier and/or require statement to make sure that just the owner can preform this function.

re1ro commented 2 years ago

The DepositHandler is deployed and destroyed by the AxelarGateway in the same transaction. So it's never available for any 3rd party calls

GalloDaSballo commented 2 years ago

Agree with the sponsor per this line: https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/AxelarGateway.sol#L391-L392