Users can’t cancel reservation due to out-of-gas
The cancellation functions loop over an owner-controlled list of cancellation items, so a large list can make the transaction run out of gas. A malicious NFT owner could set a very long list and thereby stop a reservation from being cancelled.
Submitted by Ch_301, also found by nnez
In execute.rs#cancelreservationafterapprovalforshortterm and execute.rs#cancelreservationafterapprovalforlongterm() , multiple iterations occur over the cancellation vector, which may cause the transaction to fail due to an out-of-gas error.
Consequently, malicious NFT owners could exploit this by setting a big list inside the cancellation vector by invoking execute.rs#setlistforshorttermrental() or execute.rs#setlistforlongtermrental():
pub fn setlistforlongtermrental(
/***CODE***/
cancellation: Vec<CancellationItem>,
) -> Result<Response<C>, ContractError> {
/***CODE***/
token.longterm_rental.cancellation = cancellation;
This will force the cancellation of the reservation to fail due to gas limits.
Recommended Mitigation Steps
Set a cap for the length of the cancellation vector that owners can set it.
blockchainstar12 (Coded Estate) acknowledged and commented:
Nobody sets cancellation array, as such big list and such transaction cannot be confirmed.
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
Likely the contract loops over an unbounded, owner-supplied cancellation list without capping its length.
Impact
Cancellation of a reservation could be blocked, leaving users unable to cancel; the project argued such a large transaction cannot be confirmed.
What the attacker needed
Attacker owns the NFT; attacker can set the cancellation list
How it was found
- The owner calls the set-list function for a short-term or long-term rental and supplies a very large cancellation list.
- The owner's list is stored on the token's rental data.
- A user tries to cancel the reservation after approval.
- The cancellation function loops over the long list and the transaction fails from out-of-gas.
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.
A smart contract has a limited amount of computing work it can do in one transaction, called gas. If a loop runs too many times, the transaction runs out of gas and fails. Here the owner of a property can make that list very long, so the cancellation step always fails.
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.