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.
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.
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.
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
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
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
Call collectRentUser for a target user with a very large timestamp to mark them as foreclosed.
Repeat for all users bidding on a specific token.
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
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.