# NFT withdrawal grief

A griefer sandwiches a lienee's withdrawNftWithInterest() with swapWithEth() and repayWithNft(), temporarily removing the NFT so the safeTransferFrom withdrawal reverts.

- Payout: Contest reward
- Severity: medium
- Program: Particle Protocol
- Credited: d3e4
- Disclosed: 2023-08-07
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-05-particle-findings/issues/44
- Library page: https://bugbountylibrary.com/r/c4%3A2023-05-particle%3AM-01
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:chained vuln:business-logic vuln:dos

**Target:** ParticleExchange NFT lending/swap contract (withdrawNftWithInterest, swapWithEth, repayWithNft)
**Root cause:** withdrawNftWithInterest() calls IERC721.safeTransferFrom() which reverts if the NFT is not held by the contract; a lienee's NFT can be pulled out of the contract by anyone opening a loan via swapWithEth().
**Steps:**
1. Lienee calls `withdrawNftWithInterest()` to retrieve NFT not currently on loan.
2. Attacker front-runs with `swapWithEth()`, paying `lien.credit + lien.price`, which removes the NFT from the contract.
3. Lienee's `withdrawNftWithInterest()` reverts because `safeTransferFrom` fails (NFT not in contract).
4. Attacker back-runs with `repayWithNft()`, recovering `lien.credit + lien.price` minus `payableInterest`, which is zero since loan time is zero.
**How found:** Code reading of withdrawNftWithInterest's reliance on safeTransferFrom succeeding, combined with observing swapWithEth removes the NFT from the contract and repayWithNft refunds the full amount with zero interest for instant loans.
**Exploitation:** Pure griefing sandwich: attacker pays gas only (capital returned in full via repayWithNft with zero interest), repeatedly blocking the lienee from withdrawing the NFT. No direct fund loss to attacker or lender.
**Insight:** When a withdrawal path depends on the contract currently holding an asset, check whether any permissionless function can temporarily move that asset out (open a loan/swap) and be reversed at zero cost within one transaction — that enables a cheap griefing sandwich.
