Skip to content
Business logic Audit finding Intermediate

transferBribes could transfer before proposal deadline + Input validation

The transferBribes function allowed an admin to distribute rewards before the associated proposal deadline and lacked validation that the provided token and amount matched the reward identifier. An attacker with admin privileges could transfer rewards early or with incorrect tokens and amounts.

Anurag Jain Follow

Originally disclosed on Code4rena

Submitted by csanuragjain, also found by gzeon and WatchPug

It seems that Admin can call transferBribes even when proposals belonging to this rewardIdentifier have not expired. Also due to lack of input validation, token in distributions[i].rewardIdentifier might differ from distributions[i].token and also amount is not validated

Proof of Concept

transferBribes could transfer before proposal deadline:

  1. Observe the transferBribes function at BribeVault.sol#L256
  2. This is directly distributing the rewards for a rewardIdentifier even though proposal (bribeIdentifier) linked to this rewardToBribes[rewardIdentifier] might not have expired. This means users are still depositing and Admin transferred reward early

Input Validation:

  1. Observe the transferBribes function at BribeVault.sol#L256
  2. amounts object is directly passed by Admin and there is no verification to see that sum amount of all proposals under rewardToBribes[rewardIdentifier] is equal to amount provided by admin in argument
  3. distributions[i].token is directly passed by Admin and there is no verification to see that token under distributions[i].rewardIdentifier is equal to the one provided by admin in argument

Recommended Mitigation Steps

Perform input validation.

kphed (Redacted Cartel) disagreed with Medium severity and commented:

transferBribes could transfer before proposal deadline: …

Much of the validation will be handled off-chain at the time we compute the proofs and merkle roots (we still need to write the script for that). The reason for that approach is because we will have many similar contracts (but not exactly alike - e.g. some may not have deadlines) to TokemakBribe that will interact with BribeVault. It wouldn’t be feasible to validate all the different constraints on-chain. That said, the admin is a multisig and the signers will have to agree on timing and correctness of the data to prevent this from happening.

Input Validation: …

Thanks, we’ll implement #2 and #3 to provide peace of mind to our users.

Thanks again for participating in our contest csanuragjain, looking forward to more feedback/suggestions/comments.

Alex the Entreprenerd (judge) commented:

While I understand the sponsor’s reasoning, any validation that is not enforced by the Smart Contract can’t be verified. It requires trust which could be minimized, if not removed, if the contract enforced those conditions.

bribeIdentifier, it’s relation with token, the fact that a bribe was transferred or not, all these events can be tracked onChain, offering clear paths for funds, which ultimately give more security guarantees to end users.

Because this ultimately is a trust issue, I believe medium severity to be appropriate.


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

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

Likely the transferBribes function lacked on-chain checks for proposal expiry and for consistency between the provided token, amount, and reward identifier.

Impact

An admin could transfer rewards before the proposal deadline or with incorrect tokens and amounts, potentially causing loss or misallocation of funds.

What the attacker needed

Admin privileges (multisig signers)

The fix

The project should add on-chain validation to ensure the proposal has expired and that the provided token and amount match the reward identifier.

How it was found

  1. Observe the transferBribes function in BribeVault.sol
  2. Note that it distributes rewards without checking if the linked proposal has expired
  3. Note that the amounts and tokens are passed directly by the admin without validation against the reward identifier

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.

This is a smart contract bug where an admin function could be misused. The function that sends out rewards didn't check if the reward period was over or if the token and amount were correct, so an admin could send rewards too early or with wrong details.

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 Anurag Jain

View all

63 more disclosed reports, best first.

More from Redacted Cartel contest

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.