Malicious NFT owners can rug the reservation of the long-term
A homeowner can withdraw part of a tenant's long-term rental deposit and then reject the active reservation, refunding only the reduced deposit. This lets the homeowner keep the withdrawn funds while removing the tenant.
Submitted by Ch_301, also found by nnez
Description
Due to the long period of the long-term rent, the Homeowner has an advantage in that type of reservation, which is the ability to withdraw a part from the deposited amount by the tenant. This applies only to reservations made more than one month in advance. This could be done by using execute.rs#withdrawtolandlord() function.
if item.deposit_amount - Uint128::from(token.longterm_rental.price_per_month) < Uint128::from(amount) {
The withdrawn amount will be subtracted from the user’s deposit_amount state:
token.rentals[position as usize].deposit_amount -= Uint128::from(amount);
On the other side, the NFT owner can trigger execute.rs#rejectreservationforlongterm() to reject any reservation at any time even if it currently running, it will send back .deposit_amount as a refundable amount to the user.
However, a malicious homeowner can the advantages of execute.rs#rejectreservationforlongterm() and execute.rs#withdrawtolandlord() to steal a user’s funds and reject them in two simple steps:
- Wait for the reservation to start and call
execute.rs#withdrawtolandlord(). this will transfer most of the funds out. - Now, invoke
execute.rs#rejectreservationforlongterm()to kick the user out, this will transfer back to the user only a small presenting of his initial deposit.
Note: The homeowner has the power to reject any reservation even if it is currently active by triggering rejectreservationforlongterm() and refunding user money; however, using this function, the refundable amount is the same initial deposit.
Recommended Mitigation Steps
Don’t allow to reject active reservations.
blockchainstar12 (Coded Estate) acknowledged and commented:
Actually, the platform will work as monthly deposit logic and this won’t be issue.
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 allows the homeowner to withdraw from an active rental's deposit and also allows rejecting an active reservation, with the refund based on the reduced deposit rather than the original amount.
Impact
The homeowner could steal most of a tenant's deposit while ending the rental early; the platform disputed this, saying monthly deposit logic would prevent it.
What the attacker needed
Homeowner controls the NFT; tenant has an active long-term rental; reservation made more than one month in advance
The fix
The report recommends not allowing active reservations to be rejected; the platform said monthly deposit logic would address it.
How it was found
- Wait for the long-term reservation to start.
- Call the withdraw-to-landlord function to transfer most of the deposit out.
- Call the reject-reservation-for-long-term function to remove the tenant.
- The tenant receives only the remaining reduced deposit as a refund.
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 tenant pays a deposit for a long-term rental. The homeowner is allowed to take some money out of that deposit while the rental is running, and can also cancel the rental at any time. By doing both, the homeowner can take most of the deposit and then cancel, leaving the tenant with only a small refund.
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.