paused ERC721/ERC1155 could cause stopRent to revert, potentially causing issues for the lender.
Some ERC721/ERC1155 tokens can be paused, which makes the stopRent function revert when it tries to return the NFT to the lender. This could lock the rental and keep the renter's earnings growing, especially for PAY orders.
said Follow with SBSecurity
Originally disclosed on Code4rena
Submitted by said, also found by SBSecurity
Many ERC721/ERC1155 tokens, including well-known games such as Axie Infinity, have a pause functionality inside the contract. This pause functionality will cause the stopRent call to always revert and could cause issues, especially for the PAY order type.
Proof of Concept
When stopRent /stopRentBatch is called, it will eventually trigger _reclaimRentedItems and execute reclaimRentalOrder from the safe to send back tokens to lender.
function _reclaimRentedItems(RentalOrder memory order) internal {
// Transfer ERC721s from the renter back to lender.
bool success = ISafe(order.rentalWallet).execTransactionFromModule(
// Stop policy inherits the reclaimer package.
address(this),
// value.
0,
// The encoded call to the `reclaimRentalOrder` function.
abi.encodeWithSelector(this.reclaimRentalOrder.selector, order),
// Safe must delegate call to the stop policy so that it is the msg.sender.
Enum.Operation.DelegateCall
);
// Assert that the transfer back to the lender was successful.
if (!success) {
revert Errors.StopPolicy_ReclaimFailed();
}
}
function reclaimRentalOrder(RentalOrder calldata rentalOrder) external {
// This contract address must be in the context of another address.
if (address(this) == original) {
revert Errors.ReclaimerPackage_OnlyDelegateCallAllowed();
}
// Only the rental wallet specified in the order can be the address that
// initates the reclaim. In the context of a delegate call, address(this)
// will be the safe.
if (address(this) != rentalOrder.rentalWallet) {
revert Errors.ReclaimerPackage_OnlyRentalSafeAllowed(
rentalOrder.rentalWallet
);
}
// Get a count for the number of items.
uint256 itemCount = rentalOrder.items.length;
// Transfer each item if it is a rented asset.
for (uint256 i = 0; i < itemCount; ++i) {
Item memory item = rentalOrder.items[i];
// Check if the item is an ERC721.
if (item.itemType == ItemType.ERC721)
>>> _transferERC721(item, rentalOrder.lender);
// check if the item is an ERC1155.
if (item.itemType == ItemType.ERC1155)
>>> _transferERC1155(item, rentalOrder.lender);
}
}
It can be observed that AxieInfinity has paused functionality : https://etherscan.io/address/0xf5b0a3efb8e8e4c201e2a935f110eaaf3ffecb8d
This is problematic, especially for the PAY order type. Consider a scenario where the lender is not satisfied with how the renter utilizes their PAY order’s NFTs. Now, when the lender wants to early stop the rent and calls stopRent, the call will revert, and the earning calculation for the renter will still be growing.
Recommended Mitigation Steps
Consider decoupling the NFT claim from stopRent and introducing a timestamp tracker when the lender calls stopRent. Utilize that timestamp value when the rent stop is finalized and calculate the ERC20 reward for the renter.
Alec1017 (reNFT) acknowledged and commented:
Non-standard ERC implementations were considered out of scope, but regardless we do plan on adding a whitelist for tokens interacting with the protocol
In theory the protocol could mitigate this with a pull mechanism which could be executed after the unpause and allow the counterparty to be unaffected. Currently this amounts to a temporary DOS and therefore seems like M is correct. I think its an edge case, but its plausible as the warden has shown.
Note: To see full discussion, see here.
The PR here - Implements a whitelist so only granted assets can be used in the protocol. The PR here - Implements batching functionality for whitelisting tokens so that multiple can be added at once.
Status: Mitigation confirmed. Full details in reports from EV_om and sin1st3r__.
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 stopRent function assumes the NFT transfer will succeed, but paused tokens cause the transfer to revert, and the code does not handle this failure gracefully.
Impact
The stopRent function reverts, preventing the lender from ending the rental and allowing the renter's earnings to continue accumulating; this is a temporary denial of service until the token is unpaused.
What the attacker needed
A rental order with a pausable NFT; The NFT is paused; Lender wants to stop the rental
How it was found
- A lender creates a PAY order with an NFT that can be paused.
- The renter uses the NFT and the lender becomes dissatisfied.
- The lender calls stopRent to end the rental early.
- The stopRent call reverts because the NFT is paused, so the rental continues and the renter's earnings keep growing.
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.
Some digital collectibles (NFTs) can be paused by their creators, meaning they cannot be moved. If a rental service tries to return a paused NFT to its owner, the return fails and the whole cancellation process stops. This can trap the rental and keep charging the renter.
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.