Skip to content
Business logic Audit finding Intermediate

Anyone can affect deposits of any user and turn the owner of the token

The public collectRentUser function allowed anyone to mark any user as foreclosed by passing a far-future timestamp. An attacker could foreclose all bidders for a token and then become its owner cheaply via newRental.

[a Follow

Originally disclosed on Code4rena

*Submitted by a*dlamo_

On RCTreasury, we have the method collectRentUser. This method is public, so anyone can call it using whatever user and whatever timestamp. So, calling this method using user = XXXXX and _timeToCollectTo = type(uint256).max), would make isForeclosed[user] = true.

See issue page for referenced code

Now, we can do the same for all the users bidding for a specific token. Finally, I can become the owner of the token by just calling newRental and using a small price. newRental will iterate over all the previous bid and will remove them because there are foreclosed.

Recommend that collectRentUser should be private and create a new public method with onlyOrderbook modifier.

Splidge (Reality Cards) confirmed:

I like this. Although I might change the mitigation steps. I like keeping collectRentUser available to use, we can call it from our bot and it’ll help keep user deposits updated in a timely manner for the frontend. I think I’ll just add in

require(_timeToCollectTo <= block.timestamp, "Can't collect future rent")

mcplums (Reality Cards) commented:

Yeah this is a real doozie, very happy this one was spotted!! Thanks @a_delamo :)

Splidge (Reality Cards) resolved:

Fix implemented here

The original report as published on Code4rena, by [a. 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 collectRentUser function lacked access control and did not validate that the requested collection time was not in the future.

What the attacker needed

None

The fix

The function was fixed by adding a check that the collection time is not in the future.

How it was found

  1. Call collectRentUser for a target user with a very large timestamp to mark them as foreclosed.
  2. Repeat for all users bidding on a specific token.
  3. Call newRental with a small price to become the owner of the token.

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 had a function that anyone could call to update a user's rent status. By giving it a date far in the future, an attacker could mark other users as having missed payments, which removed their bids and let the attacker take over the token cheaply.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by [a

View all

1 more disclosed report, best first.

More from Reality Cards (round 2)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.