Skip to content
Business logic Audit finding Intermediate

RFPSimpleStrategy milestones can be set multiple times

The setMilestones function in RFPSimpleStrategy could be called multiple times before the first distribution because the check relied on an index that only increments after distribution. An attacker could duplicate milestones, causing the total percentage to exceed 100%, potentially increasing payouts or breaking the pool state.

GimelSec Follow with HChang26, Martians and 6 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-09-Gitcoin-judging/issues/176

Found by

GimelSec, HChang26, Martians, WATCHPUG, ace13567, fibonacci, jkoppel, lemonmon, osmanozdemir1 Until the first distribution is completed, it's possible to call setMilestones function multiple times. New milestones are added to the previous ones. The totalAmountPercentage of all milestones in this case will be greater than 100%. It also affects all the contracts that are inherited from RFPSimpleStrategy.

Vulnerability Detail

The setMilestones function in RFPSimpleStrategy contract checks if MILESTONES_ALREADY_SET or not by upcomingMilestone index.

Solidity
if (upcomingMilestone != 0) revert MILESTONES_ALREADY_SET();

But upcomingMilestone increases only after distribution, and until this time will always be equal to 0.

Impact

It can accidentally break the pool state or be used with malicious intentions.

  1. Two managers accidentally set the same milestones. Milestones are duplicated and can't be reset, the pool needs to be recreated.
  2. The manager, in cahoots with the recipient, sets milestones one by one, thereby bypassing totalAmountPercentage check and increasing the payout amount.

Code Snippet

https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/strategies/rfp-simple/RFPSimpleStrategy.sol#L224-L247

Tool used

Manual Review

Recommendation

Fix condition if milestones should only be set once.

Solidity
if (milestones.length > 0) revert MILESTONES_ALREADY_SET();

Or allow milestones to be reset while they are not in use.

Solidity
if (milestones.length > 0) {
    if (milestones[0].milestoneStatus != Status.None) revert MILESTONES_ALREADY_IN_USE();
    delete milestones;
}

Discussion

sherlock-admin2

Escalate This is invalid. I cannot accept that a pool manager can be malicious

You've deleted an escalation for this issue.

jkoppel

#376 explains how this can cause an issue without a malicious pool owner.

MLON33

https://github.com/allo-protocol/allo-v2/pull/341

jack-the-pug

Fixed.

The original report as published on Sherlock, by GimelSec. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The check for whether milestones were already set used the upcomingMilestone index, which remains zero until after the first distribution, so the check never triggered before that point.

Impact

This could accidentally break the pool state or be exploited by a malicious manager and recipient to bypass the totalAmountPercentage check and increase the payout amount.

What the attacker needed

Manager role in the pool; No distribution completed yet

The fix

The condition should check if milestones.length > 0 to prevent setting milestones more than once, or allow resetting only when milestones are not in use.

How it was found

  1. Call setMilestones before any distribution has occurred.
  2. Call setMilestones again with additional milestones.
  3. Observe that new milestones are appended and totalAmountPercentage exceeds 100%.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract for managing project milestones allowed the manager to set milestones repeatedly before any payout. This meant the total percentage of funds allocated to milestones could go over 100%, which could lead to incorrect payouts or a broken contract.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by GimelSec

View all

18 more disclosed reports, best first.

More from Allo V2

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.