sherlock-audit / 2023-04-unitasprotocol-judging

4 stars 3 forks source link

vagrant - Front Run of addBlackList() function #132

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

vagrant

medium

Front Run of addBlackList() function

Summary

Front Run of addBlackList() function

Vulnerability Detail

Front running can be done either by sending a tx with a higher gas price (usually tx are ordered in a block by the gas price / total fee), or by paying an additional fee to the validator if they manage to run their tx without reverting (i.e. by sending additional ETH to block.coinbase, hoping validator will notice it).

Impact

Malicious user could listen the mempool in order to check if he sees a tx of blacklisting for his address , if it happens he could front run this tx by sending a tx with higher gas fee to transfer his funds to prevent them to be removed by removeBlackFunds() function

Code Snippet

https://github.com/sherlock-audit/2023-04-unitasprotocol/blob/main/Unitas-Protocol/src/ERC20Token.sol#L259

Tool used

Manual Review

Recommendation

Implement a mechanism that prevents frontrunning