Open code423n4 opened 2 years ago
We don't think this is an issue at the moment. We forked centre-token and follow the ERC20 standard, and there isn't such problem being mentioned.
Base on that people should pay attention by himself for how they approve their tokens and it is following the standards of centre-token and ERC20, we argue that this is a low-risk issue.
Since this issue was downgraded to a QA level, and the warden did not submit a separate QA report, we've renamed this one to "QA report" for consistency.
The original title, for the record, was "Race condition ERC20 approve."
Lines of code
https://github.com/code-423n4/2022-02-jpyc/blob/cfc018384dd1d71febaa57f0576cb51f5d9c7e07/contracts/v1/FiatTokenV1.sol#L240-L249
Vulnerability details
Impact
When user A call approve to change allowance of user B, user B can front run and use all the user A given allowance.
Proof of Concept
Exploitation scenario
Recommended Mitigation Steps
Add the check
require(allowed[msg.sender][_spender] == 0)