Submitted by nnez, also found by Ch_301
If the property owner calls the burn function while active rentals exist, the rental information, including deposits, is deleted. This prevents renters from retrieving their funds through the cancellation process, leading to funds of renters being stuck in the contract.
The burn function in the contract deletes all data associated with a token, including any active rental information. In Coded Estate, renters must deposit funds in advance for short-term rentals, and this information is stored in a vector, rentals, linked to the token.
The issue arises because the burn function only checks whether the caller is the owner or has approval to burn the token. It does not validate whether there are any active rentals associated with the token. As a result, if the property owner calls the burn function while rentals are still active, all rental data, including the deposit amounts, is deleted from storage.
Without the rental information, renters can no longer use the cancellation function to retrieve their deposits, as the contract does not retain any record of the rental. This leads to irreversible loss of funds for the renters.
The following test demonstrates that the token owner can burn their token while there is active rental leading to renters funds getting stuck in the contract:
Boilerplate for PoC here.
Add a validation in burn function that there is no active rental.
Invalid Validation
blockchainstar12 (Coded Estate) confirmed
