# Grieving attack by failing user's transactions

Front-running a 1-wei reduceDebt repayment on a victim's vault causes underflow, reverting their full-repayment transaction and griefing them cheaply.

- Payout: Contest reward
- Severity: medium
- Program: Backed Protocol
- Credited: HE1M
- Disclosed: 2023-01-31
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-12-backed-findings/issues/92
- Library page: https://bugbountylibrary.com/r/c4%3A2022-12-backed%3AM-03
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:solidity technique:race-window technique:source-review vuln:business-logic vuln:dos

**Target:** PaprController.reduceDebt / _reduceDebtWithoutBurn (Solidity contract)
**Root cause:** _reduceDebtWithoutBurn subtracts amount from vault debt with no cap; if a front-runner reduces debt by 1, the victim's full-repayment amount exceeds remaining debt and uint200 subtraction underflows, reverting.
**Steps:**
1. Alice has 1000e18 PaprToken debt on her NFT vault and submits reduceDebt(account=Alice, asset=NFT, amount=1000e18).
2. Bob sees tx in mempool and front-runs reduceDebt(account=Alice, asset=NFT, amount=1), paying 1 wei of PaprToken.
3. Alice's debt becomes 1000e18-1.
4. Alice's tx executes `_vaultInfo[account][asset].debt - amount` = (1000e18-1) - 1000e18, underflow reverts.
5. Repeat each time Alice retries full repayment; same applies to buyAndReduceDebt.
**How found:** Code reading of _reduceDebtWithoutBurn revealed unchecked subtraction of user-supplied amount against mutable vault debt, and reasoning that any external party can reduce another account's debt, enabling a cheap front-run griefing.
**Exploitation:** Attacker monitors mempool for full-repayment reduceDebt/buyAndReduceDebt calls, front-runs with a 1-wei repayment on the victim's account, causing the victim's transaction to revert at negligible cost.
**Insight:** When a function lets any caller mutate another user's accounting state with an absolute amount, check whether a tiny third-party write can make the victim's expected amount exceed remaining balance and revert—cheap griefing vector.
