Paladin - Warden Pledges contest - 0xDjango'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: 13/96

Findings: 2

Award: $494.96

QA:
grade-a

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: Jeiwan

Also found by: 0xDjango, Aymen0909, Chom, Lambda, Ruhum, Trust

Labels

bug
2 (Med Risk)
satisfactory
duplicate-163

Awards

314.3177 USDC - $314.32

External Links

Lines of code

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

Vulnerability details

Impact

The pledge creator must send more rewards than necessary in order to extend their pledge end timestamp or increase the reward per vote. This is because the calculation to determine the amount of rewards to send uses the original pledgeParams.votesDifference set at the time of pledge creation instead of the current balance of the receiver.

Proof of Concept

Take the following example, illustrating the calculation of rewards to send using the original vote difference:

uint256 totalRewardAmount = (pledgeParams.rewardPerVote * pledgeParams.votesDifference * addedDuration) / UNIT;

  • Creator creates pledge (receiver = creator).
  • Current creator balance = 100.
  • targetVotes = 500.
  • Time passes and the creator accumulates more of their own VE tokens. Their un-boosted balance increases to 300.
  • Creator attempts to extend their pledge.
  • The function calculates the amount of rewards to send via the original vote difference (400) instead of the current vote difference (200).
  • The creator must send double the rewards despite not needing to.

Tools Used

Manual review.

Function calls to extend the pledge or increase the reward per vote must take the current vote difference instead of the original difference set at pledge creation.

#0 - trust1995

2022-10-30T21:02:38Z

Nice, dup of my report at #234

#1 - Kogaroshi

2022-10-31T00:33:19Z

#2 - c4-judge

2022-11-10T23:07:20Z

kirk-baird marked the issue as satisfactory

#3 - c4-judge

2022-11-10T23:07:25Z

kirk-baird marked the issue as not a duplicate

#4 - c4-judge

2022-11-10T23:07:32Z

kirk-baird marked the issue as duplicate of #163

Lines of code

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

Vulnerability details

Impact

The _pledge() function contains checks ensuring that the endTimestamp is not greater than the pledgeParams.endTimestamp and that endTimestamp is rounded to the week, but it does not check that endTimestamp is larger than some minimum pledge time. Currently, an "attacker" or griefer can pledge a large amount for a small amount of time. They can pledge for a length of time where the receiver may not even have enough time to submit a transaction to take advantage of the boost.

This most likely will not provide a large monetary incentive to the attacker, but the pledge creator's reward funds will be paid out for no reason.

Proof of Concept

  • A malicious actor realizes that the week timestamp is approaching in 10 minutes.
  • They pledge a large amount of points to the pledge creator with the endTimestamp equal to the upcoming week timestamp (10 minutes away).
  • The receiver doesn't feasibly have enough time to act while the boost is active.
  • The malicious actor receives some reward without providing any benefit to the receiver.

Tools Used

Add a check for MIN_PLEDGE_TIME, a constant equal to a value that makes sense, e.g. 86400 (1 day).

#0 - trust1995

2022-10-30T21:57:00Z

I assumed the delegated boost which increases creator's balanceOf increases his earnings passively, but maybe I was wrong.

#1 - Kogaroshi

2022-10-31T21:16:30Z

Fixed in PR 2, commit

#2 - kirk-baird

2022-11-11T08:22:46Z

I agree with trust1995 that the rewards are earned passively so the creator does not need to act in these 10 minutes.

However, a minimum timestamp is recommended to prevent front-running other pledgers with one second durations. Since the warden did not describe a valid DoS vector but it is a valid issue I'm going to consider this QA.

#3 - c4-judge

2022-11-11T08:22:52Z

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

#4 - c4-judge

2022-11-12T00:14:09Z

kirk-baird marked the issue as grade-b

#5 - c4-judge

2022-11-12T00:14:24Z

kirk-baird marked the issue as grade-a

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