Open code423n4 opened 1 year ago
minhquanym marked the issue as primary issue
0xRektora marked the issue as sponsor confirmed
dmvt marked the issue as selected for report
dmvt changed the severity to 2 (Med Risk)
This attack requires external conditions. Downgrading to medium.
Lines of code
https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/tOFT/modules/BaseTOFTLeverageModule.sol#L111-L146
Vulnerability details
Impact
multiHopSell
andmultiHopBuy
can be frontrunned with high slippage tolerance. User may experince loss from a sandwich attack.Proof of Concept
When a user initiates a cross chain request to
multiHopSell
, they need to sign a EIP712 permit to approve borrow share for TOFT contract. Attacker can take the signature and frontrun the tx with same data except a lowerswapData.amountOutMin
.Action flow is multiHopSell(local) -> leverageDown(local) -> lend(remote)
As a result, user may experince loss from a sandwich attack. The attack applies to
multiHopBuy
in a similar way.Tools Used
Manual
Recommended Mitigation Steps
Set a maximum slippage.
Assessed type
Uniswap