Platform: Code4rena
Start Date: 27/10/2022
Pot Size: $33,500 USDC
Total HM: 8
Participants: 96
Period: 3 days
Judge: kirk-baird
Total Solo HM: 1
Id: 176
League: ETH
Rank: 94/96
Findings: 1
Award: $9.91
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: ladboy233
Also found by: 0x52, 0xDecorativePineapple, 0xhunter, Aymen0909, Bnke0x0, Dravee, JTJabba, Jeiwan, Lambda, Nyx, Picodes, Trust, cccz, cryptonue, csanuragjain, dic0de, hansfriese, horsefacts, imare, minhtrng, pashov, peritoflores, rbserver, rvierdiiev, wagmi, yixxas
9.9073 USDC - $9.91
https://github.com/code-423n4/2022-10-paladin/blob/main/contracts/WardenPledge.sol#L653-L661
recoverERC20 function is deployed so users who have accidently sent erc20 tokens to the contract be able to recover them. recoverERC20 uses if(minAmountRewardToken[token] != 0) revert Errors.CannotRecoverToken(); to check if token was set to one of the RewardTokens or not minAmountRewardToken is always more than 0 because in createPledge a pledge has to contain a uint256 which cant be set to 0 . there are some erc20 tokens that have multiple entry points , one of them is a proxy and another one is the main contract it self . if one of those tokens that was set as rewardToken at createPledge had multiple entry points , then it is possible to call recoverERC20 and bypass if(minAmountRewardToken[token] != 0) revert Errors.CannotRecoverToken(); and steal rewardtoken's funds .
recommendation : use a loop , 1-check all of currently rewardtokens's balances , stack them up and then check if the balance is changed after the transfer or not 2- remove this function , since it may cause lots of gas to check whole the rewardtoken's balances , the best way is to remove this function 3-move user's funds to another contract , in lines 333 394 438 , use another contract address instead of address.this so users who had sent erc20 tokens accidnetly to address.this be able to recover them without being able to steal rewardtokens
#0 - Kogaroshi
2022-10-31T00:49:13Z
Duplicate of #17
#1 - c4-judge
2022-11-09T21:48:03Z
kirk-baird marked the issue as not a duplicate
#2 - c4-judge
2022-11-09T21:51:24Z
kirk-baird marked the issue as duplicate
#3 - c4-judge
2022-11-10T21:17:19Z
kirk-baird marked the issue as satisfactory
#4 - c4-judge
2022-11-10T21:17:24Z
kirk-baird marked the issue as not a duplicate
#5 - c4-judge
2022-11-10T21:17:30Z
kirk-baird marked the issue as duplicate of #17
#6 - c4-judge
2022-12-06T17:32:42Z
Simon-Busch marked the issue as duplicate of #68