You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.
github-actionsbot opened this issue
Mar 10, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
【Tomo-M#2】create safe version ERC20-approve function
Summary
You should create a safe version of the ERC20 approve function like safeTransfer and safeTransferFrom.
Vulnerability Detail
The Pool contract has safeTransfer and safeTransferFrom functions to prevent some attack vectors. However, there is no safe version of the ERC20-approve function.
/// @notice Approves an address to spend pool tokens on behalf of the sender/// @param spender The address of the spender/// @param amount The amount of pool tokens to approve/// @return bool that indicates if the operation was successfulfunction approve(addressspender, uintamount) externalreturns (bool) {
allowance[msg.sender][spender] = amount;
emitApproval(msg.sender, spender, amount);
returntrue;
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Tomo
medium
【Tomo-M#2】create safe version ERC20-approve function
Summary
You should create a safe version of the ERC20 approve function like
safeTransfer
andsafeTransferFrom
.Vulnerability Detail
The Pool contract has
safeTransfer
andsafeTransferFrom
functions to prevent some attack vectors. However, there is no safe version of the ERC20-approve function.Therefore it happens "Multiple Withdrawal Attack"
Impact
It happens Multiple Withdrawal Attack
Code Snippet
https://github.com/sherlock-audit/2023-02-surge/blob/main/surge-protocol-v1/src/Pool.sol#L295-L303
Tool used
Manual Review
Recommendation
Add
safeIncreaseAllowance
andsafeDecreaseAllowance
refer to SafeERC20 by OpenZeppelinhttps://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/utils/SafeERC20.sol#L56-L75
Similar Issue
code-423n4/2022-04-backd-findings#180
Duplicate of #154
The text was updated successfully, but these errors were encountered: