Skip to content
DoS Audit finding Intermediate

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.

Ch_301 Follow with nnez

Originally disclosed on Code4rena

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.


The original report as published on Code4rena, by Ch_301. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

  1. The owner calls the set-list function for a short-term or long-term rental and supplies a very large cancellation list.
  2. The owner's list is stored on the token's rental data.
  3. A user tries to cancel the reservation after approval.
  4. 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.

More by Ch_301

View all

39 more disclosed reports, best first.

More from Coded Estate Invitational

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.