#  Malicious NFT owners can rug the reservation of the long-term

Homeowner withdraws most of a long-term tenant's deposit via withdrawtolandlord, then rejects the active reservation, refunding only the remainder.

- Payout: Audit contest
- Severity: medium
- Program: Coded Estate
- Found by: Ch\_301
- Disclosed: 2024-12-04
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-10-coded-estate-findings/issues/37
- Library page: https://bugbountylibrary.com/r/c4%3A2024-10-coded-estate%3AM-01
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** CosmWasm smart contract (execute.rs rental logic)
**Root cause:** withdrawtolandlord lets the homeowner pull funds out of an active long-term rental's deposit_amount, while rejectreservationforlongterm refunds only the reduced deposit_amount and can be called on an active reservation.
**Steps:**
1. Tenant books a long-term rental >1 month ahead, depositing funds into deposit_amount.
2. Reservation starts; homeowner calls `withdrawtolandlord()` with amount such that `deposit_amount - price_per_month < amount`, reducing `token.rentals[position].deposit_amount`.
3. Homeowner calls `rejectreservationforlongterm()` on the active reservation, refunding only the now-reduced deposit_amount to the tenant.
**How found:** Code review of withdrawtolandlord and rejectreservationforlongterm revealed the deposit_amount is mutable by the landlord yet used as the refund basis on rejection, and rejection is allowed on active rentals.
**Exploitation:** Homeowner waits until the rental is active, withdraws most of the tenant's deposit to themselves, then rejects the reservation; tenant is evicted and receives only the small remaining deposit.
**Insight:** When a deposit/escrow balance is both withdrawable by one party and used as the refund basis for the other party's exit, check ordering and whether the exit path can be triggered after partial withdrawal.

