Description: The callDiamondWithEIP2612Signature function is susceptible to a frontrunning attack. Frontrunning occurs when an attacker observes a pending transaction in the transaction pool and attempts to execute their transaction with a higher gas price, effectively "frontrunning" the original transaction.
The callDiamondWithEIP2612Signature function allows users to bridge tokens through the LI.FI diamond contract using an EIP2612 gasless permit. However, the function parameters diamondAddress and diamondCalldata are not signed by the user and can be modified by an attacker.
An attacker can observe a pending transaction that calls callDiamondWithEIP2612Signature and extract the tokenAddress, owner, amount, deadline, v, r, and s parameters. The attacker can then create their transaction with the same parameters but modify the diamondAddress and diamondCalldata to execute a different action or transfer the tokens to a different address.
By submitting the attacker's transaction with a higher gas price, the attacker can potentially frontrun the original transaction and execute their malicious action before it is processed.
Recommendation: Consider accepting a signature from the owner approving the diamondAddress / diamondCallData.
Context: Permit2Proxy.sol#L64
Description: The
callDiamondWithEIP2612Signature
function is susceptible to a frontrunning attack. Frontrunning occurs when an attacker observes a pending transaction in the transaction pool and attempts to execute their transaction with a higher gas price, effectively "frontrunning" the original transaction.Here's the relevant code snippet:
The
callDiamondWithEIP2612Signature
function allows users to bridge tokens through the LI.FI diamond contract using an EIP2612 gasless permit. However, the function parametersdiamondAddress
anddiamondCalldata
are not signed by the user and can be modified by an attacker.An attacker can observe a pending transaction that calls
callDiamondWithEIP2612Signature
and extract thetokenAddress
,owner
,amount
,deadline
,v
,r
, ands
parameters. The attacker can then create their transaction with the same parameters but modify thediamondAddress
anddiamondCalldata
to execute a different action or transfer the tokens to a different address.By submitting the attacker's transaction with a higher gas price, the attacker can potentially frontrun the original transaction and execute their malicious action before it is processed.
Recommendation: Consider accepting a signature from the
owner
approving thediamondAddress
/diamondCallData
.LI.FI: Fixed in 0e3debb78abcdf9a9f934115338b611e16b039a0
Researcher: Verified.