Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

dipp - Race condition in the approve function of Pool.sol #215

Closed
github-actions bot opened this issue Mar 10, 2023 · 0 comments
Closed

dipp - Race condition in the approve function of Pool.sol #215

github-actions bot opened this issue Mar 10, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@github-actions
Copy link

github-actions bot commented Mar 10, 2023

dipp

high

Race condition in the approve function of Pool.sol

Summary

The approve function in Pool.sol is vulnerable to a race condition that might allow an approved spender to spend more tokens than intended.

Vulnerability Detail

A token holder can change the allowance of a spender by calling the approve function. The spender can front run the call to approve to spend the previous allowance. When the new allowance is set the spender can transfer more tokens although the owner might have intended for the spender to only be able to spend the new allowance.

For example: The owner sets an allowance of 100 tokens for a spender. The owner then decided to decrease the allowance to 50 tokens. The spender sees this and front runs the call to approve to transfer 100 tokens, reducing the spender's allowance to 0. The call to approve then sets the spenders allowance to 50 tokens and the spender is can transfer an additional 50 tokens. The spender transferred 150 tokens instead of the intended 50 tokens.

Impact

Spender can transfer more tokens than expected.

Code Snippet

Pool.sol#L299-L303

Tool used

Manual Review

Recommendation

Consider changing the logic of the approve function to increase or decrease the allowance instead of setting it directly.

Duplicate of #154

@github-actions github-actions bot added Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue labels Mar 10, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Mar 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant