When forming POL the DAO will end up stucked with DAI and USDS tokens that cannot handle
The DAO contract cannot handle tokens other than SALT, so when forming POL during upkeep, leftover USDS and DAI tokens are sent back to the DAO and become stuck forever. An attacker could not directly exploit this, but the DAO loses funds.
Submitted by 0xRobocop, also found by oakcobalt, deepplus, DanielArmstrong, and KupiaSec
The DAO contract cannot handle any token beside SALT tokens. So, if tokens like USDS or DAI were in its balance, they will be lost forever.
This can happen during the upkeep calls. Basically, during upkeep the contract takes some percentage from the arbitrage profits and use them to form POL for the DAO (usds/dai and salt/usds). The DAO swaps the ETH for both of the needed tokens and then adds the liquidity using the zapping flag to true.
Zapping will compute the amount of either tokenA or tokenB to swap in order to add liquidity at the final ratio of reserves after the swap. But, it is important to note that the zap computations do no take into account that the same pool may get arbitraged atomically, changing the ratio of reserves a little.
As a consequence, some of the USDS and DAI tokens will be send back to the DAO contract:
Proof of Concept
The following coded PoC should be pasted into root_tests/Upkeep.t.sol, actually its the same test that can be found at the end of the file with some added lines to showcase the issue. Specifically, it shows how the USDS and DAI balance of the DAO are zero before upkeep and how both are greater than zero after upkeep.
function testDoublePerformUpkeep() public {
_setupLiquidity();
_generateArbitrageProfits(false);
// Dummy WBTC and WETH to send to Liquidizer
vm.prank(DEPLOYER);
weth.transfer( address(liquidizer), 50 ether );
// Indicate that some USDS should be burned
vm.prank( address(collateralAndLiquidity));
liquidizer.incrementBurnableUSDS( 40 ether);
// Mimic arbitrage profits deposited as WETH for the DAO
vm.prank(DEPLOYER);
weth.transfer(address(dao), 100 ether);
vm.startPrank(address(dao));
weth.approve(address(pools), 100 ether);
pools.deposit(weth, 100 ether);
vm.stopPrank();
// === Perform upkeep ===
address upkeepCaller = address(0x9999);
uint256 daiDaoBalanceBefore = dai.balanceOf(address(dao));
uint256 usdsDaoBalanceBefore = usds.balanceOf(address(dao));
assertEq(daiDaoBalanceBefore, 0);
assertEq(usdsDaoBalanceBefore, 0);
vm.prank(upkeepCaller);
upkeep.performUpkeep();
// ==================
_secondPerformUpkeep();
uint256 daiDaoBalanceAfter = dai.balanceOf(address(dao));
uint256 usdsDaoBalanceAfter = usds.balanceOf(address(dao));
assertTrue(daiDaoBalanceAfter > 0);
assertTrue(usdsDaoBalanceAfter > 0);
}
Recommended Mitigation Steps
The leftovers of USDS or DAI should be send to liquidizer so they can be handled.
othernet-global (Salty.IO) commented:
The DAO contract uses the available token balances to form POL, ensuring no extra tokens left in the contract.
https://github.com/othernet-global/salty-io/commit/5364426aaf97e646fa3990f148e364167adcd0a5
POL has been removed from the protocol:
eaf40ef0fa27314c6e674db6830990df68e5d70e https://github.com/othernet-global/salty-io/commit/8e3231d3f444e9851881d642d6dd03021fade5ed
Status: Mitigation confirmed. Full details in reports from 0xpiken, zzebra83, and t0x1c.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the DAO contract lacks functionality to transfer or handle tokens other than SALT, and the zap logic in liquidity addition does not account for atomic arbitrage that changes pool ratios, causing leftover tokens to be returned to the DAO.
Impact
The DAO permanently loses the leftover USDS and DAI tokens, which could accumulate over time.
What the attacker needed
DAO receives USDS or DAI during upkeep; Arbitrage occurs atomically in the same pool
The fix
The DAO contract was updated to use available token balances when forming POL, and later POL was removed from the protocol entirely.
How it was found
- Set up liquidity and generate arbitrage profits.
- Transfer WETH to the Liquidizer and indicate some USDS should be burned.
- Transfer WETH to the DAO as arbitrage profits and deposit it into the pools.
- Record the DAO's DAI and USDS balances before upkeep (both zero).
- Call performUpkeep.
- Record the DAO's DAI and USDS balances after upkeep (both greater than zero).
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The DAO is a smart contract that holds and manages funds. It was only designed to handle its own SALT token, so if other tokens like USDS or DAI end up in its balance, it has no way to move them out. During a routine operation called upkeep, some of these tokens are accidentally left in the DAO and become permanently stuck.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.