Reproduced Exploit
Liquorice: reBalance calls quoteExactInput and the supplied WETH is taken
reBalance transfers the pool's WETH to UniswapIntegration and then calls whatever _swapData the caller supplies. quoteExactInput returns 0, abi.decode accepts that 0, and nothing is swapped back. A following swap on the integration sends the stuck 5 WETH to the attacker. The pool and the integratio…
Loss
5 WETH of supplied liquidity leaves the pool and ends with the caller
Chain
Ethereum
Category
access-control
Date
Oct 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. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 49434-arbitrary-call-in-lendingpoolrebalance-leads-to-asset-theft. Standalone Foundry PoC and full write-up: 49434-arbitrary-call-in-lendingpoolrebalance-leads-to-asset-theft_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/access-control/missing-auth
Key info#
| Field | Value |
|---|---|
| Loss | 5 WETH of supplied liquidity leaves the pool and ends with the caller |
| Vulnerable contract | LendingPool.reBalance |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2024-10 |
| Compiler | solc 0.8.27, cancun |
| Bug class | _swapData is an unrestricted call into UniswapIntegration |
TL;DR#
reBalance transfers the pool's WETH to UniswapIntegration and then calls whatever _swapData the caller supplies. quoteExactInput returns 0, abi.decode accepts that 0, and nothing is swapped back. A following swap on the integration sends the stuck 5 WETH to the attacker. The pool and the integration both end at 0.
The vulnerable code#
weth.transfer(address(uni), amount);
(bool ok, bytes memory result) = address(uni).call(_swapData); // @> VULN: _swapData can call any UniswapIntegration function, not only swap()
require(ok, "call");
decodedOut = abi.decode(result, (uint256));
- (bool ok, bytes memory result) = address(uni).call(_swapData);
+ (bool ok, bytes memory result) = address(uni).call(
+ abi.encodeWithSelector(uni.swap.selector, tokenIn, address(this), amount)
+ );
Root cause#
The intended callee is swap. The parameter is raw calldata, so quoteExactInput is a valid target. Its uint256 return decodes as the expected amount-out and happens to be 0, which the pool does not reject. There is also no minAmount check. The tokens were transferred before the call, so a 0 result leaves them in the integration, where swap is permissionless.
Preconditions#
- The lending pool holds 5 WETH of supplier liquidity.
UniswapIntegration.quoteExactInputreturns 0.swaptransfers whatever token balance the integration holds.
Attack walkthrough#
- 5 WETH sits in the pool.
- The attacker calls
reBalancewithquoteExactInputselector data. - The pool transfers 5 WETH to the integration.
- The arbitrary call returns 0. The pool decodes 0 and does not pull tokens back.
- The attacker calls
swapand receives the 5 WETH. - Pool and integration balances are 0.
Diagrams#
Impact#
Suppliers lose 5 WETH. The attacker holds the full amount. A hard-coded swap call, with a minimum amount out, would not leave the tokens sitting in the integration.
How to reproduce#
cd 49434-arbitrary-call-in-lendingpoolrebalance-leads-to-asset-theft_exp
forge test -vv
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/49434-arbitrary-call-in-lendingpoolrebalance-leads-to-asset-theft.md
- MixBytes Liquorice report: https://github.com/mixbytes/audits_public/blob/master/Liquorice/README.md
- Audited
LendingPool.reBalance: https://github.com/Liquorice-HQ/contracts/blob/a5b4c6a56df589b8ea4f6c7b8cb028b1723ad479/src/contracts/LendingPool.sol#L229
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 49434-arbitrary-call-in-lendingpoolrebalance-leads-to-asset-theft_exp (evm-hack-registry mirror).
- AuditVault finding: 49434-arbitrary-call-in-lendingpoolrebalance-leads-to-asset-theft.
Alerts & third-party analyses
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.