Distributions must not match actual bribes
The BribeVault.transferBribes function accepts distribution parameters without verifying they match the actual deposited bribes, allowing the admin to create arbitrary distributions. An attacker with admin access could under- or overreport amounts, take amounts from other bribes, or steal all amounts by using 100% fees.
Submitted by cmichel
The BribeVault.transferBribes transfers tokens for distribution.
All parameters (amounts, distributions) are blindly accepted by the function and never verified to match the actual bribes that were deposited for the distributions[i].rewardIdentifier.
The distributions[i].token must not match the distributions[i].rewardIdentifier’s token (included in the reward identifier hash), and the amounts[i] (and fees) must not match the bribes[bribeIdentifier].amount.
The admin can submit arbitrary values and create distributions that don’t reflect the bribe the distribution is actually for. It’s easy to under-or overreport amounts for a bribe, take amounts from a different bribe, or steal all amounts from users by using 100% fees, distribute the same bribe over and over, etc.
Recommended Mitigation Steps
Reduce the trust that users need to have in the admin by validating the Common.Distribution[] calldata distributions, uint256[] calldata amounts, uint256[] calldata fees parameters against the deposited bribes.
For example:
- Check that the
distributions[i].tokenmatches thedistributions[i].rewardIdentifier - The amount + fees equal the
bribes[bribeIdentifier].amount, then reset thebribes[bribeIdentifier].amount.
kphed (Redacted Cartel) disagreed with High severity and commented:
We will be adding validation to the
transferBribesmethod to provide peace of mind to our users, however, we consider this low-risk for the reasons below.All parameters (amounts, distributions) are blindly accepted by the function and never verified to match the actual bribes that were deposited for the distributions[i].rewardIdentifier. …
Compilation and thorough validation of the data necessary for calling
transferBribeswill be done off-chain using a publicly auditable set of scripts in our repo.Additionally, since the method can only be called by the protocol multisig (i.e. admin), signers will have the opportunity to review the data prior to submitting their signature. In conjunction with the above, they can generate their own data using the script and compare it against what is to be submitted.
Thanks again for participating in our contest cmichel, looking forward to more feedback/suggestions/comments.
Alex the Entreprenerd (judge) decreased severity to Medium and commented:
I agree with the finding, the math for onChain bribes is not validated, while the math for bribes distribution is blindly trusted.
This finding highlights a type of admin privilege, in which the admin can set arbitrary claims which do not reflect the actual state of the system.
For this reason, as well as the eloquence of the warden, am going to mark this as valid and of medium severity.
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 lacks validation of the distribution parameters against the deposited bribe amounts and reward identifiers.
Impact
The admin could create distributions that do not reflect the actual bribes, potentially stealing all amounts from users by using 100% fees or distributing the same bribe multiple times.
What the attacker needed
Admin access (protocol multisig)
The fix
The function should be fixed by validating the distributions, amounts, and fees against the deposited bribes, for example by checking that the token matches the reward identifier and that the amount plus fees equals the stored bribe amount.
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 issue where a function that distributes rewards does not check that the amounts and tokens match what was actually deposited. Because only the admin can call it, the risk is that a malicious or compromised admin could redirect funds incorrectly. The fix is to add checks that compare the distribution data against the stored bribe amounts.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.