Rialto may not be able to cancel minipools created by contracts that cannot receive AVAX
A minipool owner contract that cannot receive AVAX can block Rialto's attempt to cancel the minipool, because the cancellation function sends AVAX to the owner and reverts on failure. This allows a malicious node operator to prevent cancellation of their minipool.
Jeiwan Follow with AkshaySrivastav, peritoflores and 1 other
Originally disclosed on Code4rena
Submitted by Jeiwan, also found by AkshaySrivastav, peritoflores, and ladboy233
A malicious node operator may create a minipool that cannot be cancelled.
Proof of Concept
Rialto may cancel a minipool by calling cancelMinipoolByMultisig, however the function sends AVAX to the minipool owner, and the owner may block receiving of AVAX, causing the call to cancelMinipoolByMultisig to fail (MinipoolManager.sol#L664):
function _cancelMinipoolAndReturnFunds(address nodeID, int256 index) private {
...
address owner = getAddress(keccak256(abi.encodePacked("minipool.item", index, ".owner")));
...
owner.safeTransferETH(avaxNodeOpAmt);
}
The following PoC demonstrates how calls to cancelMinipoolByMultisig can be blocked:
function testCancelMinipoolByMultisigDOS_AUDIT() public {
uint256 duration = 2 weeks;
uint256 depositAmt = 1000 ether;
uint256 avaxAssignmentRequest = 1000 ether;
uint128 ggpStakeAmt = 200 ether;
// Node operator is a contract than cannot receive AVAX:
// contract NodeOpContract {}
NodeOpContract nodeOpContract = new NodeOpContract();
dealGGP(address(nodeOpContract), ggpStakeAmt);
vm.deal(address(nodeOpContract), depositAmt);
vm.startPrank(address(nodeOpContract));
ggp.approve(address(staking), MAX_AMT);
staking.stakeGGP(ggpStakeAmt);
MinipoolManager.Minipool memory mp1 = createMinipool(depositAmt, avaxAssignmentRequest, duration);
vm.stopPrank();
bytes32 errorCode = "INVALID_NODEID";
int256 minipoolIndex = minipoolMgr.getIndexOf(mp1.nodeID);
store.setUint(keccak256(abi.encodePacked("minipool.item", minipoolIndex, ".status")), uint256(MinipoolStatus.Prelaunch));
// Rialto trices to cancel the minipool created by the node operator contract but the transaction reverts since
// the node operator contract cannot receive AVAX.
vm.prank(address(rialto));
// FAIL: reverted with ETH_TRANSFER_FAILED
minipoolMgr.cancelMinipoolByMultisig(mp1.nodeID, errorCode);
}
Recommended Mitigation Steps
Consider using the Pull over Push pattern to return AVAX to owners of minipools that are canceled by Rialto.
emersoncloud (GoGoPool) confirmed
Alex the Entreprenerd (judge) commented:
The warden has shown how the checked return value from call can be used as a grief to prevent canceling of a minipool.
The finding can have different severities based on the context, in this case, the cancelling can be denied, however, other state transitions are still possible.
For this reason (functionality is denied), I agree with Medium Severity.
emersoncloud (GoGoPool) commented:
Acknowledged.
We’ll make a note of this in our documentation, but not fixing immediately.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The cancellation function uses a push transfer of AVAX to the owner, which can be blocked by a contract that rejects incoming AVAX.
Impact
A malicious node operator could prevent Rialto from cancelling their minipool, though other state transitions remain possible.
What the attacker needed
Node operator is a contract that rejects AVAX; sufficient GGP and AVAX to create a minipool
How it was found
- Deploy a contract that cannot receive AVAX and use it as the node operator.
- Stake GGP and create a minipool from that contract.
- Set the minipool status to Prelaunch.
- Call cancelMinipoolByMultisig as Rialto; the transaction reverts with ETH_TRANSFER_FAILED.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a minipool is cancelled, the system tries to send AVAX back to the owner. If the owner is a smart contract that refuses to accept AVAX, that send fails and the whole cancellation fails. So a bad actor can set up such a contract and make their minipool impossible to cancel.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.