Reproduced Exploit
Autonomint: borrower downside protection is recovered into the whole CDS pool
Chain
Other
Category
untagged
Date
Nov 2024
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 734. Standalone Foundry PoC and full write-up: 45464-h-11-borrower-withdrawing-at-a-loss-will-cause-losses-for-cd_exp in the
evm-hack-registrymirror.
Vulnerability classes: liquidation-logic · reward-accounting · integer-bounds · locked-funds
Reproduction: deploys the REAL audited Autonomint protocol (full
Core_logic+libat Sherlock snapshot0d324e04d4c0ca306e1ae4d4c65f0cb9d681751b) with minimal real doubles only for the opaque external venues (Ionic, WETH, Synthetix, RedStone oracle) and the repo's ownEndpointV2MockLayerZero stack. No mainnet fork.
Root cause#
When a borrower withdraws while underwater, BorrowLib.withdraw increases
omniChainData.downsideProtected and the CDS realizes that loss by subtracting it from
totalCdsDepositedAmount (CDS.withdraw / CDSLib). When the price later recovers, the
protection is credited back to the pool at large (divided by the full
totalCdsDepositedAmount) rather than to the specific depositor that funded it. The
aggregate therefore drifts below the sum of the individual deposits and a later depositor
cannot be made whole.
Vulnerable sources: src/lib/BorrowLib.sol (downside protection
increase) and src/Core_logic/CDS.sol (withdraw, downside
realization + return-amount calculation).
Exploit walkthrough (real numbers)#
- CDS depositor #1 deposits 6,000 USDT.
- A borrower deposits 1 ETH at $1,000.
- Price drops to $900; the borrower withdraws at a loss — this adds ~100 USDa of downside protection that is deducted from the pool aggregate (0.5 ETH is paid to a fresh EOA).
- A second borrower deposits 1 ETH at $900; price recovers to $1,000.
- CDS depositor #2 deposits 6,000 USDT.
- Both depositors put in 6,000 each (12,000 total) at the same net price, yet
totalCdsDepositedAmountreads 11,900 — a permanent 100 USDa shortfall that strands the later depositor.
test/…_exp.sol asserts totalCdsDepositedAmount < 12,000e6.
Reproduction#
_shared/run-poc/run_poc.sh 45464-h-11-borrower-withdrawing-at-a-loss-will-cause-losses-for-cd_exp -vvvvv
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 45464-h-11-borrower-withdrawing-at-a-loss-will-cause-losses-for-cd_exp (evm-hack-registry mirror).
- AuditVault finding: 734.
- Upstream DeFiHackLabs PoC directory: src/test.
Alerts & third-party analyses
- DeFiHackLabs incident explorer: search "Autonomint: borrower downside protection is recovered into the whole CDS pool".
- Web3Sec X hacked database: search.
- Rekt leaderboard: search.
- Solodit incident search: search.
These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.