Closed c4-bot-3 closed 8 months ago
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as duplicate of #404
MarioPoneder marked the issue as unsatisfactory: Invalid
MarioPoneder changed the severity to QA (Quality Assurance)
MarioPoneder marked the issue as grade-c
Lines of code
https://github.com/code-423n4/2023-12-revolutionprotocol/blob/d42cc62b873a1b2b44f57310f9d4bbfdd875e8d6/packages/revolution/src/ERC20TokenEmitter.sol#L152
Vulnerability details
ERC20TokenEmitter::buyToken()
is vulnerable to frontrunning attack which will give buyer less token than expected.Impact
The Amount of token that will be received by the buyer during the token buy in
ERC20TokenEmitter::buyToken()
depends upon the total emitted supply of the tokens. If a user buys some tokens then an attacker can front run his transaction which will give the user less tokens than expected.Proof of Concept
Here is a test for POC:
Output:
As you can see the transaction reverted as the expected amount and received amount is not equal as you can check from logs.
Tools Used
Recommended Mitigation Steps
Consider adding a paramter in the function for
minAmountOut
for the minimum amount of tokens expected from the function and adding neccessary checks for the same.Assessed type
Other