Reproduced Exploit
LEND: `CoreRouter.redeem` overpays a precomputed amount, draining its reserve
Chain
Other
Category
untagged
Date
Jan 1970
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: 464. Standalone Foundry PoC and full write-up: 58376-lend-corerouter-redemption-payout-is-miscalculated_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/theft · vuln/logic
Reproduction: a faithful minimal reproduction of the vulnerable finding — the vulnerable
redeempayout ofCoreRouteris reproduced verbatim (marked@>) with faithful minimal doubles; local deploy, no fork.
Root cause#
CoreRouter.redeem computes expectedUnderlying from exchangeRateStored() before the redeem, then pays the user that fixed amount. It never checks how much underlying LToken.redeem() actually transferred back — so when the LToken returns less (a redemption fee, or a rate not reflected in the stored value), CoreRouter pays out more than it received. The vulnerable lines, reproduced verbatim:
// Get exchange rate before redeem
uint256 exchangeRateBefore = LTokenInterface(_lToken).exchangeRateStored();
// Calculate expected underlying tokens
uint256 expectedUnderlying = (_amount * exchangeRateBefore) / 1e18;
// Perform redeem
require(LErc20Interface(_lToken).redeem(_amount) == 0, "Redeem failed");
// Transfer underlying tokens to the user
@> IERC20(_token).transfer(msg.sender, expectedUnderlying); // pays precomputed amount, never checks actual received
expectedUnderlying is fixed from the stored rate and used verbatim for the payout, while the amount LToken.redeem() actually delivered to CoreRouter is discarded — the two are never reconciled.
Why it's exploitable here#
Following the finding's discrepancy with a stored rate of 2e18 and a 10% LToken redemption fee that is not reflected in exchangeRateStored():
- A user holding
100e18lTokens callsCoreRouter.redeem(100e18, lToken). CoreRouter readsexchangeRateBefore = 2e18and computesexpectedUnderlying = 100e18 * 2e18 / 1e18 = 200e18. LToken.redeem(100e18)computes gross200e18, retains the10%fee (20e18), and transfers onlynet = 180e18to CoreRouter.- CoreRouter transfers the full precomputed
200e18to the user —20e18more than it just received. - That
20e18shortfall is eaten from CoreRouter's1000e18reserve of other depositors' funds. Every redemption under this discrepancy drains the reserve by exactly the shortfall.
Attack path#
Marked-line walkthrough (Playground)#
The EVM Playground pins each step to the exact executed source line in 0xbd4fd5a3…:
- L167 — Check redeemer's lToken balance: CoreRouter requires the redeemer already holds at least
_amountlTokens, so the redeem path proceeds for a legitimately funded position. - L175 — Read the stored exchange rate: Reads
exchangeRateStored()before redeeming — a value that ignores the redemption fee the LToken will actually charge on the way out. - L181 — LToken redeem pays net underlying: Calls
LToken.redeem, which sends CoreRouter only the post-fee net underlying; the return value is checked for success but the amount is ignored. - L184 — Pay unchecked precomputed amount: Root cause: pays the user the pre-computed
expectedUnderlyingand never checks the smaller amount LToken actually sent, so CoreRouter overpays from its reserve. - L187 — Bookkeeping proceeds unaware: Distributes rewards and updates the position as if the payout matched receipts, so the reserve shortfall is never recorded or corrected.
- L195 — Emit success hiding the shortfall: Emits
RedeemSuccessreporting the inflatedexpectedUnderlying, so off-chain monitors see a clean redeem despite the drained reserve. - L207 — Declare the drained underlying token: Setup: declares the underlying token whose CoreRouter reserve of other depositors' funds is overpaid away by exactly the fee shortfall.
PoC#
Registry (Foundry, local deploy — verbatim vulnerable source + harm-asserting test):
cd 58376-lend-corerouter-redemption-payout-is-miscalculated_exp && forge test -vvv
The browser Playground replays the same synthetic opcode-for-opcode and measures the harm: redeem 100e18 lTokens, CoreRouter receives 180e18 net but pays the user the full 200e18, draining 20e18 from its reserve of other depositors' funds. Both gates are green (registry forge test PASS + Playground _verify-poc VERDICT: PASS).
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 58376-lend-corerouter-redemption-payout-is-miscalculated_exp (evm-hack-registry mirror).
- AuditVault finding: 464.
- Upstream DeFiHackLabs PoC directory: src/test.
Alerts & third-party analyses
- DeFiHackLabs incident explorer: search "LEND:
CoreRouter.redeemoverpays a precomputed amount, draining its reserve". - 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.