-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attakers can steal the funds from long-term reservation #41
Comments
OpenCoreCH marked the issue as duplicate of #12 |
OpenCoreCH marked the issue as satisfactory |
Hey there @OpenCoreCH I think the root cause here is the incorrect use of |
Good point thanks, first thought about duplicating it with #6 now because both are about auto approvals and cancelling later on. But the fix for #6 would not help here, the cancellation happens after the withdraw call. So even if approvals were removed, this attack would still work. |
OpenCoreCH marked the issue as not a duplicate |
OpenCoreCH marked the issue as selected for report |
@blockchainstar12 Sponsors are not allowed to close, reopen, or assign issues or pull requests. |
We remove setting approvals from setbidtobuy() function |
Lines of code
https://github.com/code-423n4/2024-10-coded-estate/blob/main/contracts/codedestate/src/execute.rs#L1795
Vulnerability details
Description
In this protocol NFT owner can set the NFT in sale even if it is still under active rent by triggering
execute.rs#setlistforsell()
which could settoken.sell.auto_approve
to a true value (means anyone can directly be approved and this will open multiple doors for attackers)Users can call
execute.rs#setbidtobuy()
and send the necessary amount to gain approval of this NFTUsing the same function
setbidtobuy()
any address that has an existing bid in the NFT can cancel its bid and receive back all the initial funds (no fees in this function).On the other side, the owner or any approved address can invoke
execute.rs#withdrawtolandlord()
and specify the receiver of the withdrawal funds (this function gives the homeowners the ability to withdraw a part of the funds even before the rent end, this is only for longterm rentals )However, the Attacker can create a sophisticated attack using
withdrawtolandlord()
andsetbidtobuy()
1- Choose an NFT that has a
token.sell.auto_approve == true
and an active long-term rental2- Call
setbidtobuy()
this will give him the necessary approval to finish the attack, he also need to transfer the asked funds .3- Trigger
withdrawtolandlord()
and transfer the maximum amount of tokens4- Invoke
setbidtobuy()
to receive his original deposited funds.Impact
Steal the funds from long-term reservations using
setbidtobuy()
Tools Used
Manual Review
Recommended Mitigation Steps
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: