<!-- canonical: https://0xsimao.com/findings/beraborrow-i-withdrawal-epoch-prev-icr -->

# `ManagedLeveragedVault::executeWithdrawalEpoch()` will never work because `cd.prevICR` is not set

Medium · Sherlock · CDP stablecoin · 25th April, 2025

Finding M-3 of the Beraborrow Managed Dens security review.

- Protocol: https://www.beraborrow.com/
- Report: /reports/beraborrow-i
- Source: https://1570492309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FffzDCMBDa391vIMqruBP%2Fuploads%2FUKDtjc6Dkn6P6i35j5H1%2FManaged%20Leverage%20Vaults%20v0%20private%20audit%20Sherlock.pdf?alt=media&token=c7304efa-8040-4ed0-9a98-dc949af28a85

---

## Summary

`ManagedLeveragedVault::executeWithdrawalEpoch()` asserts the new ICR is close to the old one, but the latter is never set. Marking medium as the contract is upgradeable.

## Vulnerability Detail

The last check in `ManagedLeveragedVault::executeWithdrawalEpoch()` is:
```solidity
_checkInvariantICR(getCurrentDenICR(), cd.prevICR, Tolerance.BOTH);
```
However, `cd.prevICR` is never set and it will always revert.

## Impact

DoSed withdrawals

## Code Snippet

https://github.com/sherlock-audit/2025-04-beraborrow-vault-update/pull/1/files#diff-2d972f52027e0ba1065b2de2b424416244bfef9e2a79d2604e1687867f72c91eR393

## Tool Used

Manual Review

## Recommendation

Set the old ICR.

---

Related findings:

- [`PreDepositVault::sweep()` uses `address.transfer` which does not work for certain wallets](https://0xsimao.com/findings/gaib-deposit-sweep-transfer-wallets): GAIB Pre-Vaults
- [`PreDepositVault` will not work for USDT](https://0xsimao.com/findings/gaib-pre-deposit-work-usdt): GAIB Pre-Vaults
- [Cap::setEpochCap() may add a stale cap](https://0xsimao.com/findings/mitosis-cap-epoch-add-stale): Mitosis
- [Changing the epoch duration will completely break the vault and the slashers](https://0xsimao.com/findings/symbiotic-relay-epoch-duration-completely-slashers): Symbiotic Relay
