57884 sc low staking tier manipulation via erc4626 shares slong
Description
Brief / Intro
Vulnerability Details
// contracts/v2/platform/BelongCheckIn.sol // Venue tier lookup VenueStakingRewardInfo memory stakingInfo = stakingRewards[ _storage.contracts.staking.balanceOf(venueInfo.venue).stakingTiers() ].venueStakingInfo; // Promoter tier lookup PromoterStakingRewardInfo memory stakingInfo = stakingRewards[ _storage.contracts.staking .balanceOf(promoterInfo.promoter) .stakingTiers() ].promoterStakingInfo;// contracts/v2/utils/Helper.sol /// @notice Resolves the staking tier based on the staked amount of LONG (18 decimals). function stakingTiers(uint256 amountStaked) external pure returns (StakingTiers tier) { if (amountStaked < 50000e18) { return StakingTiers.NoStakes; } else if (amountStaked >= 50000e18 && amountStaked < 250000e18) { return StakingTiers.BronzeTier; } else if (amountStaked >= 250000e18 && amountStaked < 500000e18) { return StakingTiers.SilverTier; } else if (amountStaked >= 500000e18 && amountStaked < 1000000e18) { return StakingTiers.GoldTier; } return StakingTiers.PlatinumTier; }// contracts/v2/periphery/Staking.sol contract Staking is Initializable, ERC4626, Ownable { // Deposit mints shares; share-based bookkeeping function _deposit(address by, address to, uint256 assets, uint256 shares) internal override { super._deposit(by, to, assets, shares); stakes[to].push(Stake({shares: shares, timestamp: block.timestamp})); } // Clear separation of assets and shares function emergencyWithdraw(uint256 assets, address to, address _owner) external returns (uint256 shares) { if (assets > maxWithdraw(_owner)) revert WithdrawMoreThanMax(); shares = previewWithdraw(assets); // convert assets -> shares _emergencyWithdraw(msg.sender, to, _owner, assets, shares); } }// contracts/v2/platform/BelongCheckIn.sol uint256 platformFee = stakingInfo.depositFeePercentage.calculateRate(venueInfo.amount);// contracts/v2/platform/BelongCheckIn.sol uint24 percentage = promoterInfo.paymentInUSDC ? stakingInfo.usdcPercentage : stakingInfo.longPercentage; uint256 platformFees = percentage.calculateRate(toPromoter);
Impact Details
References
Proof of Concept
Recommended Fixes (not exhaustive)
Previous57236 sc medium accesstoken collection front running attack permanent ownership hijack Next57669 sc medium stakers will bypass minstakeperiod time locks and extract rewards without commitment through emergency withdrawal mechanism
Was this helpful?