Phoenix-Protocol-Group / phoenix-contracts

Source code of the smart contracts of the Phoenix DeFi hub DEX protocol
GNU General Public License v3.0
10 stars 6 forks source link

PHOAM-017: Adversaries can steal rewards via unbond #348

Closed gangov closed 2 months ago

gangov commented 2 months ago

Location

./contracts/stake_rewards/src/contract.rs:187

Description Anyone can obtain more rewards than intended by repeatedly calling the calculate_unbond function to increase the shares_correction. This function allows unbonding the same stake (last_stake in the snippet below) multiple times without tracking those already unbonded. Consequently, adversaries can continuously increase their shares correction.

Since old_power is greater than new_power, the update_rewards function causes the adversary's shares_correction variable to increase, enabling them to withdraw more rewards than intended.

Recommendation Ensure that a stake cannot be bonded or unbonded more than once.

gangov commented 2 months ago

already solved