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

0xaliyah - infinite approval will always revert for some ERC20 compliant tokens #82

Open
sherlock-admin2 opened this issue Sep 13, 2024 · 1 comment

Comments

@sherlock-admin2
Copy link

sherlock-admin2 commented Sep 13, 2024

0xaliyah

Medium

infinite approval will always revert for some ERC20 compliant tokens

Summary

    /**
     * @notice Approves `grantee` to spend infinite tokens from the caller
     * @dev Uses `approve` rather than `safeApprove` since the race condition
     *      in safeApprove does not apply when going to an infinite approval
     * @param self Token to grant approval
     * @param self Token to grant approval
     * @param grantee Address to allow spending
     */

Vulnerability Detail

  1. #revert-on-large-approvals--transfers

Impact

  1. Some tokens (e.g. UNI, COMP) revert if the value passed to approve or transfer is larger than uint96.

Code Snippet

  1. TokenOrEther18.sol
  2. Token6.sol
  3. Token18.sol

Tool used

Manual Review

Recommendation

@sabatha7
Copy link

sabatha7 commented Sep 13, 2024

Quirks in the COMP token itself
The COMP token that the rewards contract distributes does not store balances as a uint256 like most ERC 20 tokens do, but rather as a uint96.

COMP token balances mapping

If you try to transfer or approve an amount greater than the uint96 maximum value, the transaction will revert.

@sherlock-admin3 sherlock-admin3 changed the title Tame Punch Seal - infinite approval will always revert for some ERC20 compliant tokens 0xaliyah - infinite approval will always revert for some ERC20 compliant tokens Sep 23, 2024
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

2 participants