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 May 26, 2023. It is now read-only.
github-actionsbot opened this issue
Feb 21, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
Attacker can fund malicious tokens to make competitor unable to claim their reward.
Summary
In AtomicBounty, when paying the reward for closer, the bounty needs to loop through the entire tokenAddress[] array. So if there is a failed transfer in a iteration, the entire process will revert.
Since the bounty allows funders to deposit into the bounty unwhitelisted tokens if the token addresses is not reached, attacker can abuse this techinique by creating a malicious ERC20 token. This malicious token will revert when transferring from bounty to user, which will make a iteration in the loop of function ClaimManagerV1._claimAtomicBounty failed then make the whole function call revert.
Vulnerability Detail
Attacker can deploy a malicious ERC20 which reverts every transfer() call (not transferFrom()) like below:
pragma solidity 0.8.17;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
contract MockMaliciousERC20 is ERC20 {
address public admin;
constructor() ERC20('Mock MAL', 'mMAL') {
_mint(msg.sender, 10000 * 10**18);
admin = msg.sender;
}
/// [#explain] revert every transfer tx
function transfer(address to, uint256 amount) public virtual override returns (bool) {
require(0 == 1, "Iam a malicious ERC20");
}
}
Consider to just deal with whitelisted token.
Or you can define a new storage array additionalTokens[] which will be modified by the bounty's issuer and let these token permission to be deposited into bounty.
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` labelHighA valid High severity issueRewardA payout will be made for this issue
TrungOre
high
Attacker can fund malicious tokens to make competitor unable to claim their reward.
Summary
In AtomicBounty, when paying the reward for closer, the bounty needs to loop through the entire
tokenAddress[]
array. So if there is a failed transfer in a iteration, the entire process will revert.Since the bounty allows funders to deposit into the bounty unwhitelisted tokens if the token addresses is not reached, attacker can abuse this techinique by creating a malicious ERC20 token. This malicious token will revert when transferring from bounty to user, which will make a iteration in the loop of function
ClaimManagerV1._claimAtomicBounty
failed then make the whole function call revert.Vulnerability Detail
Attacker can deploy a malicious ERC20 which reverts every
transfer()
call (nottransferFrom()
) like below:Here is the test scripts:
You can place it in
ClaimManager.test.js
->describe('ClaimManager.sol')
->describe('claimBounty')
->describe('ATOMIC')
->describe('TRANSFER')
Impact
Competitors who join the bounty can't claim their rewards.
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L45-L50
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L130-L148
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L230-L249
Tool used
Hardhat
Recommendation
Consider to just deal with whitelisted token.
Or you can define a new storage array
additionalTokens[]
which will be modified by the bounty's issuer and let these token permission to be deposited into bounty.Duplicate of #62
The text was updated successfully, but these errors were encountered: