Paladin - Warden Pledges contest - cccz'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: 2/96

Findings: 4

Award: $5,659.22

QA:
grade-b

🌟 Selected for report: 1

🚀 Solo Findings: 1

Findings Information

🌟 Selected for report: cccz

Labels

bug
2 (Med Risk)
satisfactory
sponsor acknowledged
edited-by-warden
selected for report
M-01

Awards

5382.1424 USDC - $5,382.14

External Links

Lines of code

https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L245-L246

Vulnerability details

Impact

In the _pledge function, require delegationBoost.adjusted_balance_of(pledgeParams.receiver) + amount <= pledgeParams.targetVotes. In reality, when the user pledges amount votes, the actual votes received by the receiver are the bias in the following calculation. And the bias will be less than amount due to the loss of precision.

uint256 slope = amount / boostDuration; uint256 bias = slope * boostDuration;

This means that the balance of receiver may not reach targetVotes

point = self._checkpoint_read(_user, False) amount += (point.bias - point.slope * (block.timestamp - point.ts)) return amount

Proof of Concept

https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L245-L246 https://github.com/curvefi/curve-veBoost/blob/master/contracts/BoostV2.vy#L192-L209 https://github.com/curvefi/curve-veBoost/blob/master/contracts/BoostV2.vy#L175

Tools Used

None

Use bias instead of amount in the check below

uint256 slope = amount / boostDuration; uint256 bias = slope * boostDuration; if(delegationBoost.adjusted_balance_of(pledgeParams.receiver) + bias > pledgeParams.targetVotes) revert Errors.TargetVotesOverflow(); delegationBoost.boost( pledgeParams.receiver, amount, endTimestamp, user );

#0 - Kogaroshi

2022-10-30T23:12:26Z

The current check is made that way to prevent any unnecessary call to the BoostV2 contract (and save gas by not creating the Boost) in the case of a targetVotes overflow.

#1 - c4-judge

2022-11-11T07:59:37Z

kirk-baird marked the issue as satisfactory

#2 - trust1995

2022-11-17T15:46:08Z

I believe there is no actual M level issue here, the worst case scenario is an inconvenience so that user has to pass bias (i.e. rounded amount) instead of amount (I presume this will already occur in the front end). No risk of funds or malfunctioning of the protocol shown.

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/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L653-L661

Vulnerability details

Impact

In the recoverERC20 function, when minAmountRewardToken[token] ! = 0, the token cannot be withdrawn by the owner. However, the owner can call the removeRewardToken function to make minAmountRewardToken[token] == 0 and then call the recoverERC20 function to rug that reward token.

Proof of Concept

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

Tools Used

None

Consider removing the recoverERC20 function

#0 - Kogaroshi

2022-10-30T23:16:43Z

Duplicate of #17

#1 - c4-judge

2022-11-10T07:44:35Z

kirk-baird marked the issue as not a duplicate

#2 - c4-judge

2022-11-10T07:44:42Z

kirk-baird marked the issue as duplicate

#3 - c4-judge

2022-11-10T21:25:07Z

kirk-baird marked the issue as satisfactory

#4 - c4-judge

2022-11-10T21:25:12Z

kirk-baird marked the issue as not a duplicate

#5 - c4-judge

2022-11-10T21:25:20Z

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

Findings Information

🌟 Selected for report: rbserver

Also found by: 0x1f8b, 0xSmartContract, Trust, cccz, codexploder, ctf_sec, hansfriese

Labels

bug
2 (Med Risk)
satisfactory
duplicate-269

Awards

247.5252 USDC - $247.53

External Links

Lines of code

https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L456-L457

Vulnerability details

Impact

When the system is paused, the creator cannot withdraw the remaining reward tokens via the retrievePledgeRewards/closePledge functions. Considering that when the system is paused, the user cannot increase the creator's vote via the _pledge function, the creator may want to withdraw his reward tokens since no new pledges are attracted, so the whenNotPaused modifier should not be added to the retrievePledgeRewards/closePledge functions. And if the system is paused indefinitely, the creator's reward tokens will be frozen in the contract

Proof of Concept

https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L456-L457 https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L488-L489

Tools Used

None

Consider removing the whenNotPaused modifier from the retrievePledgeRewards/closePledge functions.

#0 - trust1995

2022-10-30T22:07:35Z

Nice, dup of #233

#1 - Kogaroshi

2022-10-30T23:14:01Z

Duplicate of #70

#2 - c4-judge

2022-11-11T08:02:06Z

kirk-baird marked the issue as not a duplicate

#3 - c4-judge

2022-11-11T08:02:10Z

kirk-baird marked the issue as primary issue

#4 - c4-judge

2022-11-11T08:06:22Z

kirk-baird marked the issue as satisfactory

#5 - Simon-Busch

2022-11-11T08:07:50Z

Removed "primary issue" as request by @kirk-baird

#6 - c4-judge

2022-11-11T08:09:08Z

kirk-baird marked the issue as duplicate of #70

#7 - c4-judge

2022-12-06T17:36:20Z

Simon-Busch marked the issue as duplicate of #269

Lines of code

https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L466-L475

Vulnerability details

Impact

There are ERC20 tokens that charge fee for every transfer() or transferFrom().

The reward token may be fee-on-transfer token.

In the current implementation, createPledge/extendPledge/increasePledgeRewardPerVote assumes that the received amount is the same as the transfer amount, and uses it to calculate rewardPerVote.

As a result, in _pledge(), later users may not be able to successfully claim their rewards, as it may revert for insufficient balance. And in retrievePledgeRewards()/closePledge(), the creator cannot withdraw the remaining reward tokens due to insufficient balance.

Proof of Concept

https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L266-L271 https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L466-L475 https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L502-L508

Tools Used

None

Consider getting the received amount by calculating the difference of token balance (using balanceOf) before and after the transferFrom.

#0 - Kogaroshi

2022-10-30T23:15:39Z

Duplicate of #27

#1 - c4-judge

2022-11-10T07:23:07Z

kirk-baird marked the issue as not a duplicate

#2 - c4-judge

2022-11-10T07:23:17Z

kirk-baird marked the issue as duplicate

#3 - c4-judge

2022-11-10T07:34:02Z

kirk-baird marked the issue as not a duplicate

#4 - c4-judge

2022-11-10T07:34:09Z

kirk-baird changed the severity to QA (Quality Assurance)

#5 - c4-judge

2022-11-11T23:53:52Z

kirk-baird marked the issue as grade-b

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