The identified security concern in the smart contract code involves the potential for balance theft due to arbitrary code execution when sending rewards to the owner address.
If the owner address is a smart contract and its receive function includes the selfdestruct operation, executing the claimAmbientRewards function can lead to the unintended self-destruction of the smart contract and the loss of its Ether balance.
This can have significant repercussions, including the destruction of smart contracts and the disruption of the intended behavior of the system.
function claimConcentratedRewards(bytes32 poolIdx, int24 lowerTick, int24 upperTick, uint32[] memory weeksToClaim)
public
payable
{
claimConcentratedRewards(payable(msg.sender), poolIdx, lowerTick, upperTick, weeksToClaim);
}
Malicious smart contract can contain selfdestruct() in its receive function when executor calls one of the functions that invoke callOutAndBridgeMultiple like:
contract SelfDestructingContract {
public address owner;
constructor(address _owner ) {
owner = _owner
}
// All this does is self destruct and send funds to "to"
receive() external payable {
selfdestruct(payable(owner));
}
}
Tools Used
Manual review
Recommended Mitigation Steps
Consider using a pull payment pattern where the recipient (e.g., refundee) initiates the transfer of tokens or ETH instead of being sent tokens directly. This gives the recipient more control over the process and reduces the risk of malicious actions.
Lines of code
https://github.com/code-423n4/2023-10-canto/blob/main/canto_ambient/contracts/mixins/LiquidityMining.sol#L286 https://github.com/code-423n4/2023-10-canto/blob/main/canto_ambient/contracts/mixins/LiquidityMining.sol#L193
Vulnerability details
Impact
The identified security concern in the smart contract code involves the potential for balance theft due to arbitrary code execution when sending rewards to the owner address. If the owner address is a smart contract and its receive function includes the selfdestruct operation, executing the claimAmbientRewards function can lead to the unintended self-destruction of the smart contract and the loss of its Ether balance. This can have significant repercussions, including the destruction of smart contracts and the disruption of the intended behavior of the system.
Proof of Concept
it s called here
and the same bug exist in
and it s called in
Malicious smart contract can contain selfdestruct() in its receive function when executor calls one of the functions that invoke callOutAndBridgeMultiple like:
}
Tools Used
Manual review
Recommended Mitigation Steps
Consider using a pull payment pattern where the recipient (e.g., refundee) initiates the transfer of tokens or ETH instead of being sent tokens directly. This gives the recipient more control over the process and reduces the risk of malicious actions.
Assessed type
call/delegatecall