Paladin - Warden Pledges contest - 0xhunter's results

A governance lending protocol transforming users voting power into a new money lego.

General Information

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

Paladin

Findings Distribution

Researcher Performance

Rank: 94/96

Findings: 1

Award: $9.91

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

9.9073 USDC - $9.91

Labels

bug
2 (Med Risk)
satisfactory
duplicate-68

External Links

Lines of code

https://github.com/code-423n4/2022-10-paladin/blob/main/contracts/WardenPledge.sol#L653-L661

Vulnerability details

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

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter