Attakers can steal the funds from long-term reservation
When an NFT is listed for sale with auto-approval enabled, anyone who places a bid is automatically approved as a spender on that NFT. Because an approved address can call the long-term rental withdrawal function and choose the recipient, an attacker can withdraw the rental funds to themselves.
Submitted by Ch_301
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 set token.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 NFT:
File: execute.rs#setbidtobuy()
675: if token.sell.auto_approve {
676: // update the approval list (remove any for the same spender before adding)
677: let expires = Expiration::Never { };
678: token.approvals.retain(|apr| apr.spender != info.sender);
679: let approval = Approval {
680: spender: info.sender.clone(),
681: expires,
682: };
683: token.approvals.push(approval);
684:
685: }
Using 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).
File: execute.rs
1787: pub fn withdrawtolandlord(
/**CODE**/
1796: address:String
1797: ) -> Result<Response<C>, ContractError> {
/**CODE**/
1848: .add_message(BankMsg::Send {
1849: to_address: address,
1850: amount: vec{{media:0}}**
---
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 auto-approval on bidding grants spender rights that are not restricted to sale-related actions, so the same approval also authorises the rental withdrawal function.
Impact
An attacker could take rental funds that belong to the homeowner by withdrawing them to their own address.
What the attacker needed
NFT listed for sale with auto-approve on; attacker can place a bid
The fix
Auto-approval granted through bidding should be scoped to sale actions only, and the rental withdrawal function should not accept arbitrary approved spenders as callers.
How it was found
- The NFT owner lists the NFT for sale with auto-approval enabled.
- An attacker places a bid on the NFT, which automatically adds them to the approval list.
- The attacker calls the long-term rental withdrawal function as an approved address and sets the recipient to their own address.
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.
An NFT here is a digital ownership token for a rented property. The contract lets the owner list it for sale, and if auto-approval is on, anyone who bids is quietly given permission to act on the NFT. That permission is enough to trigger a withdrawal of the rental money and send it to an address the attacker picks.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.