Security Considerations Mentioned in IERC20Permit.sol
There are two important considerations concerning the use of permit.
The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way.
The second is that because permits have built-in replay protection and can be submitted by anyone, they can be front-run. A protocol that uses permits should take this into consideration and allow a permit call to fail.
The Ditto contract inherits the ERC20Permit contract but does not handle this function inside the contract.
The permit function is public and is vulnerable to front-run attacks as mentioned above in the summary section.
This function takes the spender address, so anyone who uses the permit function to give the allowance to any spender address can be front-run and an attacker can pass his address in the spender parameter and will get the tokens.
IERC20Permit.sol - Line 47 - 48
The note is also mentioned in the IERC20Permit contract.
Anyone who gives allowance to anyone using the permit function can lose his all funds before even the receive claim the allowance.
Manual Review
A recommendation is already mentioned in the IERC20Permit contract;
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.