The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Valid

Pricision Error in `distributeAssets()` Could Lead to Undercollateralization of EUROs

Description:

Precision error in distributeAsset when distributing 8 decimal tokens like WBTC leads to users missing out on rewards and undercollateralization of EUROs. The larger the stakedTotal, the larger the denomination to divide by, causing _portion for some users to be 0. Consequently, some collateral will not be sold in the pool and sent back to LiquidationPoolManager despite having enough pool balance to buy these tokens. Assets that aren't sold are sent back to the LiquidationPoolManager, which then sends it to the protocol (i.e., treasury).

Impact:

The delay between the time of liquidation and selling of these assets to cover the loss exposes EUROs to undercollateralization.

Proof of Concept:

Calculating a staker's portion in the given conditions results in zero.

  • wBTC reward: 1e8 (1 BTC)

  • Staker's positions: 1e18

  • Total Stake: 1000000000e18

Although the discrepancy between the staker's position and total stake is so wide, making the effect of such transactions seem almost inconsequential, this can accumulate over time or over multiple users to cause a significant impact on the protocol.

// uint256 _portion = asset.amount * _positionStake / stakeTotal;
_portion = (1e8 * 1e18) / 1000000000e18 // 0

Tools Used:

  • Manual Review

  • Foundry

Recommended Mitigation Steps:

Convert 8 decimal tokens to 18 before calculating stakers' portion.

Updates

Lead Judging Commences

hrishibhat Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

precision

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!