Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absence of slippage protection could lead to execution at very high prices due to frontrunning attacks. #245

Closed
c4-bot-3 opened this issue Dec 20, 2023 · 5 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-397 edited-by-warden satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality

Comments

@c4-bot-3
Copy link
Contributor

c4-bot-3 commented Dec 20, 2023

Lines of code

https://github.com/code-423n4/2023-12-revolutionprotocol/blob/d42cc62b873a1b2b44f57310f9d4bbfdd875e8d6/packages/revolution/src/ERC20TokenEmitter.sol#L152

Vulnerability details

Vulnerability Details:

The ERC20TokenEmitter contract features a buyToken() method enabling users to acquire governance ERC20VotesToken, with token prices determined by a linear VRGDA contract. This contract's pricing mechanism relies on daily emissions. However, a critical issue arises as users are unable to specify slippage. In the absence of slippage protection, malicious users could front-run trades, increasing the emission schedule. For instance, if a user wants to buy tokens, a malicious user could front run the trade causing an increase in emission schedule, The user's trade would be executed at unexpectedly higher prices. This vulnerability poses a risk of adverse execution outcomes for users.

Impact:

Users would be forced to accept trades at very bad prices.

Proof of Concept:

   //Absence of slippage could allow users to buy tokens at very terrible prices
    //Alice sends a buyToken[] transaction to the mempool,Bob spots the tx and creates the same trade
    //further pushing the tokenEmitter schedule forward which exponentially increases price and when alice's trade
    //get's executed it gets executed at a very high price than expected.
    function buyToken(
        address[] calldata addresses,
        uint256[] calldata basisPointSplits,
        ProtocolRewardAddresses calldata protocolRewardsRecipients
    ) public payable nonReentrant whenNotPaused returns (uint256 tokensSoldWad) {

Tools Used

Vscodium

Recommended Mitigation Steps:

Add a slippage parameter to the buyToken method , to determine minimum acceptable amounts by the users.

Assessed type

MEV

@c4-bot-3 c4-bot-3 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Dec 20, 2023
c4-bot-6 added a commit that referenced this issue Dec 20, 2023
@c4-pre-sort
Copy link

raymondfam marked the issue as sufficient quality report

@c4-pre-sort c4-pre-sort added the sufficient quality report This report is of sufficient quality label Dec 22, 2023
@c4-pre-sort
Copy link

raymondfam marked the issue as duplicate of #26

@c4-pre-sort
Copy link

raymondfam marked the issue as duplicate of #397

@c4-judge c4-judge added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Jan 6, 2024
@c4-judge
Copy link
Contributor

c4-judge commented Jan 6, 2024

MarioPoneder changed the severity to 2 (Med Risk)

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Jan 6, 2024
@c4-judge
Copy link
Contributor

c4-judge commented Jan 6, 2024

MarioPoneder marked the issue as satisfactory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-397 edited-by-warden satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality
Projects
None yet
Development

No branches or pull requests

4 participants