# `Borrowing::redeemYields` debits `ABOND` from `msg.sender` but redeems to `user` using `ABOND.State` data from `user`

Borrowing::redeemYields checks and debits ABOND from msg.sender but computes and sends redemption using the user parameter's ABOND state, letting an attacker drain ETH backing another user's position.

- Payout: Audit contest
- Severity: high
- Program: Autonomint
- Found by: 0x73696d616f
- Disclosed: 2024-11-26
- Write-up quality: 8/10
- Original: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/271
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-autonomint%3AH-3
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:access-control vuln:accounting-error vuln:business-logic

**Target:** Borrowing/BorrowLib redeemYields and Treasury.withdrawFromExternalProtocol
**Root cause:** redeemYields validates and burns ABOND from msg.sender (zeroing msg.sender's ethBacked/cumulativeRate) but computes the withdrawal amount and sends ETH using the user parameter's ABOND.State, so the two identities diverge.
**Steps:**
1. Attacker address A deposits ETH into Borrowing and receives ABOND backed by ETH in Ionic (large ethBacked, cumulativeRate).
2. Wait until cumulativeRate grows significantly.
3. Attacker address B acquires some ABOND (purchase externally or via protocol).
4. B calls `Borrowing::redeemYields(user=A, aBondAmount)` where aBondAmount <= A's aBondBalance.
5. BorrowLib checks `aBondAmount > abond.userStates(A).aBondBalance` (passes), computes withdrawAmount from A's ethBacked/cumulativeRate, calls `treasury.withdrawFromExternalProtocol(A, aBondAmount)`.
6. Treasury redeems underlying from Ionic using A's state and sends ETH to A; then `abond.burnFromUser(msg.sender=B, aBondAmount)` debits B, leaving A's state intact.
7. Repeat: B keeps buying small ABOND and redeeming against A's untouched position, draining ETH backing.
**How found:** Code reading of redeemYields: noticed the balance check and burnFromUser use different addresses (user vs msg.sender) than the withdrawal calculation, revealing an identity mismatch between who is debited and whose state prices the redemption.
**Exploitation:** Attacker controls two addresses: A holds a large ABOND position with accrued ethBacked; B holds minimal ABOND. B repeatedly calls redeemYields with user=A, causing Treasury to redeem ETH from Ionic based on A's state and forward it to A, while only B's ABOND is burned. A's position is never debited, so the ETH backing can be drained across iterations.
**Escalation:** Repeated calls across many small ABOND purchases scale the drain until the external protocol's ETH backing ABOND is exhausted, collapsing ABOND value.
**Insight:** When a function takes a `user` parameter alongside msg.sender, trace every state read and write to confirm they reference the same address; mismatches between the account validated/burned and the account whose stored state prices the payout are a recurring drain primitive.

