# When a private vault offers a loan in ERC777 tokens, the private vault can refuse to receive repayment in the safeTransferFrom callback to force liquidation of the borrower's collateral

Private vault lending ERC777 tokens can revert in the safeTransferFrom callback, blocking borrower repayment and forcing collateral liquidation at expiry.

- Payout: Contest reward
- Severity: medium
- Program: Astaria
- Credited: cccz
- Disclosed: 2023-05-22
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-01-astaria-findings/issues/247
- Library page: https://bugbountylibrary.com/r/c4%3A2023-01-astaria%3AM-21
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:dos vuln:liquidation

**Target:** LienToken repayment / TransferProxy ERC20 safeTransferFrom
**Root cause:** Repayment sends tokens directly to the private vault owner via safeTransferFrom; for ERC777 tokens the recipient's tokensReceived callback can revert, so the borrower's makePayment always fails.
**Steps:**
1. Private vault owner offers loan denominated in an ERC777 token
2. Borrower calls `LienToken.makePayment` to repay
3. `TransferProxy.tokenTransferFrom` calls `ERC20(token).safeTransferFrom(payer, payee, amount)` where payee = vault `recipient()` = owner
4. Owner's ERC777 `tokensReceived` hook reverts, reverting the whole repayment
5. Loan cannot be repaid; at expiry collateral is auctioned/liquidated
**How found:** Code reading of the repayment path: noticed `recipient()` returns the owner for private vaults and that repayment uses `safeTransferFrom`, which invokes recipient hooks for ERC777 tokens, enabling recipient-controlled revert.
**Exploitation:** Malicious private vault owner lends ERC777 tokens, then reverts in the ERC777 recipient hook on every repayment attempt, ensuring the borrower defaults and their collateral is liquidated for the vault owner's benefit.
**Insight:** When a protocol pays a user-controlled address via safeTransferFrom, any token with recipient hooks (ERC777) lets that address grief the payer by reverting; check whether repayment/withdrawal paths route funds to an attacker-controlled recipient.
