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

Itchy Ultraviolet Monkey - Token approvals are vulnerable to front-running attacks #245

Open
sherlock-admin3 opened this issue Dec 31, 2024 · 0 comments

Comments

@sherlock-admin3
Copy link
Contributor

Itchy Ultraviolet Monkey

Medium

Token approvals are vulnerable to front-running attacks

Summary

The approve() function in CToken.sol and Numa.sol is vulnerable to front-running attacks. A malicious spender can front-run an approval change transaction to spend both the old allowance and the new allowance, potentially resulting in the loss of user tokens.

Root Cause

In CToken.sol and Numa.sol there are no functions to safely increase and decrease allowance

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

Consider the following scenario:

  1. Alice approves Bob to transfer 5 tokens
  2. Alice decides to reduce this allowance to 3 tokens
  3. Bob notices the allowance reduction tx in the mempool and frontruns it to spend the initial allowance of 5 tokens
  4. Bob is granted a new allowance of 3 tokens, and spends it for a total of 8 tokens spent.

Impact

Malicious spender can front-run approve and spend more than intended

PoC

No response

Mitigation

Add increaseAllowance and decreaseAllowance functions to Numa and CToken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant