Submitted by gpersoon.
The function \_depositAndProvideLiquidity can be used go retrieve arbitrary ERC20 tokens from the TempusController.sol contract.
As the test contract of TempusController.sol https://goerli.etherscan.io/address/0xd4330638b87f97ec1605d7ec7d67ea1de5dd7aaa shows, it has indeed ERC20 tokens.
The problem is due to the fact that you supply an arbitrary tempusAMM to depositAndProvideLiquidity and thus to \_depositAndProvideLiquidity.
tempusAMM could be a fake contract that supplies values that are completely fake.
At the end of the function \_depositAndProvideLiquidity, ERC20 tokens are send to the user. If you can manipulate the variables ammTokens,  mintedShares  and sharesUsed you can send back
any tokens held in the contract
ammTokens[0].safeTransfer(msg.sender, mintedShares - sharesUsed[0]);
The Proof of Concept shows an approach to do this.
Now fakeMintedShares - ammLiquidityProvisionAmounts number of TokenToSteal1 and TokenToSteal2 are transferred to msg.sender
As you can both manipulate TokenToSteal1 and fakeMintedShares, you can transfer any token to msg.sender
Create a whitelist for tempusAMMs
mijovic (Tempus) confirmed:
mijovic (Tempus) commented:
mijovic (Tempus) patched:
0xean (judge) commented:
