Closed c4-submissions closed 1 year ago
This is a generic ERC20 problem that's only relevant when you give approval to untrusted parties or contracts that allow untrusted parties to trigger a transferFrom
. Definitely not high severity.
minhquanym marked the issue as primary issue
minhquanym marked the issue as low quality report
laurenceday (sponsor) disputed
laurenceday marked the issue as disagree with severity
MarioPoneder marked the issue as unsatisfactory: Overinflated severity
Lines of code
https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/market/WildcatMarketToken.sol#L31-L34 https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/market/WildcatMarketToken.sol#L41-L57
Vulnerability details
Impact
Bob steals tokens from Alice.
Proof of Concept
In the file
WildcatMarketToken.sol
there is anapprove
function:that is susceptible to a frontrunning attack. Let's suppose Alice calls the
approve
function withspender == address(Bob)
andamount == 100
. Soon after that Alice decides that her allowance to Bob is too big and decides to reduce it - Alice calls theapprove
function again withspender == address(Bob)
and reduced amountamount == 50
. Bob monitors the Ethereum mempool and sees that Alice gave him some allowance and then reduced it. Bob is not happy with that. Bob waits for Alice's first transaction withamount == 100
to pass. After this transaction is complete Bob has an allowance ofamount == 100
. Right after that Bob callstransferFrom
function from the fileWildcatMarketToken.sol
frontrunning Alice's second transaction withamount == 50
. As a result Bob transfersamount == 100
to his address. After that Alice's second transaction withamount == 50
is completed and Bob is allowed to spend 50 more units of a token. Bob callstransferFrom
again and takes these 50 units of a token as well. As a result, Alice intended to give Bob an allowance of 50 units of a token, but Bob managed to take from Alice 150 units of a token, essentially stealing 100 units of a token.Tools Used
Manual review.
Recommended Mitigation Steps
Use OZ libraries.
Assessed type
MEV