Yield distribution after large payout seems unfair
The reporter argued that a large payout reducing the unallocated SherX pool could leave later users unable to claim their yield, while earlier users were paid in full. The project disputed the fairness claim but confirmed a related medium-risk issue where a payout with a non-zero unallocated amount could block a user from harvesting again or transferring their lock tokens.
Submitted by gpersoon
When a large payout occurs, it will lower unallocatedSherX. This could mean some parties might not be able to get their Yield.
The first couple of users (for which harvest is called or which transfer tokens) will be able to get their full Yield, until the moment unallocatedSherX is depleted. The next users don’t get any yield at all. This doesn’t seem fair.
function doYield(ILock token,address from, address to, uint256 amount) private {
...
ps.unallocatedSherX = ps.unallocatedSherX.sub(withdrawable_amount);
function payout( address _payout, IERC20[] memory _tokens, uint256[] memory _firstMoneyOut, uint256[] memory _amounts, uint256[] memory _unallocatedSherX, address _exclude ) external override onlyGovPayout {
// all pools (including SherX pool) can be deducted fmo and balance
// deducting balance will reduce the users underlying value of stake token
// for every pool, _unallocatedSherX can be deducted, this will decrease outstanding SherX rewards
// for users that did not claim them (e.g materialized them and included in SherX pool)
....
// Subtract from unallocated, as the tokens are now allocated to this payout call
ps.unallocatedSherX = ps.unallocatedSherX.sub(unallocatedSherX);
Recommend that If unallocatedSherX is insufficient to provide for all the yields, only give the yields partly (so that each user gets their fair share).
Not only
unallocatedSherXis subtracted but alsosWeight, which is used to calculate the reward. I wrote some extra tests and in my experience the remaining SherX (in the unallocatedSherX variable) is splitted in a fair way.
Together with gpersoon I discussed both issue #49 and #50 and based on both findings we found a med-risk issue. In case
payout()is called with_unallocatedSherX > 0and a user calledharvest()before the payout call. It blocks the user from callingharvest()again. + blocks the lock token transfer.Mitigations step is to stop calling
payout()with_unallocatedSherX > 0
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 payout function reduces the shared unallocated reward pool and related weight state in a way that can leave a user's harvest or transfer blocked after a payout with a non-zero unallocated amount.
Impact
The project disputed the unfair-distribution claim, but confirmed a medium-risk issue where a user who harvested before a payout with a non-zero unallocated amount could no longer harvest or transfer their lock tokens.
What the attacker needed
A payout with non-zero unallocated SherX; user harvested before the payout
The fix
The suggested mitigation was to stop calling payout with a non-zero unallocated SherX 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 about a rewards pool in a smart contract. Rewards owed to users are tracked in a shared pot, and a big payout shrinks that pot. The reporter worried that whoever claims first gets paid and later people get nothing, though the project said the reward calculation still splits things fairly. A separate confirmed problem was that a payout could lock a user out of claiming or moving their tokens.
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.