code-423n4 / 2023-07-pooltogether-findings

12 stars 7 forks source link

`ApproveMax` will not work for some tokens that don't support approve `type(uint256).max` amount. #257

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L282

Vulnerability details

Impact

If this code is executed on a token that does not support approve type(uint256).max amount, the function will revert and the transaction will fail

Proof of Concept

https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L282

The safeApprove function in the ERC20 standard allows a user to approve an unlimited amount of tokens to be transferred to another address. However, some tokens do not support this feature and will revert if they are called with the type(uint256).max amount

Tools Used

Manual analysis

Recommended Mitigation Steps

I would suggest approve only the necessay amount of token to the approveTarget instead of the type(uint256).max amount.

Assessed type

ERC20

c4-judge commented 1 year ago

Picodes marked the issue as unsatisfactory: Overinflated severity