Submitted by Ruhum, also found by minhtrng, ulqiorra, 0xMirce, rvierdiiev, gjaldon, cccz, 0xRobocop, and chaduke
https://github.com/code-423n4/2023-01-popcorn/blob/main/src/utils/MultiRewardStaking.sol#L296-L315
https://github.com/code-423n4/2023-01-popcorn/blob/main/src/utils/MultiRewardStaking.sol#L351-L360
The changeRewardSpeed() doesnt calculate the new endTimestamp correctly. That causes the reward distribution to be broken.
Given that we have an existing reward with the following configuration:
The reward speed is changed at timestamp = 50, meaning 100 tokens were already distributed. The new endTimestamp is calculated by calling _calcRewardsEnd():
And the calculation is:
Because rewardEndTimestamp > block.timestamp, the if clause is executed and amount is increased:
$amountNew = 100 + 4 \ast (100 - 50) = 300$
Then it calculates the new endTimestamp:
$50 + (300 / 4) = 125$
Thus, by increasing the rewardsPerSecond from 2 to 4, weve increased the endTimestamp from 100 to 125 instead of decreasing it. The total amount of rewards that are distributed are calculated using the rewardsPerSecond and endTimestamp. Meaning, the contract will also try to distribute tokens it doesnt hold. It only has the remaining 100 tokens.
By increasing the rewardsPerSecond the whole distribution is broken.
Its not easy to fix this issue with the current implementation of the contract. There are a number of other issues. But, in essence:
RedVeil (Popcorn) confirmed, but disagreed with severity 
LSDan (judge) decreased severity to Medium 
