You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stuart_the_minion - mintUBIFromInterest(), mintUBIFromReserveBalance() and mintRewardFromReserveRatio() will be denied when the exchange reserve balance is 0
#57
mintUBIFromInterest(), mintUBIFromReserveBalance() and mintRewardFromReserveRatio() will be denied when the exchange reserve balance is 0
Summary
When an exchange is created, the reserve balance can be 0 or any positive value.
By the way, the GoodDollarExchangeProvider::mintFromInterest() will be reverted due to division by zero when the reserve balance is 0, denying mintUBIFromInterest(), mintUBIFromReserveBalance() and mintRewardFromReserveRatio() in GoodDollarExpansionController.
Therefore, when the reserve balance is 0, this function will be reverted with the division error.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
Minting UBI from interest and reserve balance will be denied.
I think, creating an exchange with 0 reserve balance doesn't require a malicious owner, and there exists possibility that an owner can make a mistake because there's no restriction on input reserve balance.
[PASS] test_mintUBI_zeroBalance() (gas: 335787)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 3.28ms (617.00µs CPU time)
As can be seen from the logs, three minting functions are denied due to zero reserve balance.
Mitigation
I'd suggest adding the minimum limit of reserve balance when creating an exchange.
The text was updated successfully, but these errors were encountered:
sherlock-admin3
changed the title
Pet Tawny Loris - mintUBIFromInterest(), mintUBIFromReserveBalance() and mintRewardFromReserveRatio() will be denied when the exchange reserve balance is 0
stuart_the_minion - mintUBIFromInterest(), mintUBIFromReserveBalance() and mintRewardFromReserveRatio() will be denied when the exchange reserve balance is 0
Nov 5, 2024
stuart_the_minion
Medium
mintUBIFromInterest()
,mintUBIFromReserveBalance()
andmintRewardFromReserveRatio()
will be denied when the exchange reserve balance is 0Summary
When an exchange is created, the reserve balance can be 0 or any positive value.
By the way, the
GoodDollarExchangeProvider::mintFromInterest()
will be reverted due to division by zero when the reserve balance is 0, denyingmintUBIFromInterest()
,mintUBIFromReserveBalance()
andmintRewardFromReserveRatio()
inGoodDollarExpansionController
.Root Cause
The
GoodDollarExpansionProvider::mintFromInterest()
doesn't check ifexchange.reserveBalance
is zero.Therefore, when the reserve balance is 0, this function will be reverted with the division error.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
Minting UBI from interest and reserve balance will be denied.
I think, creating an exchange with 0 reserve balance doesn't require a malicious owner, and there exists possibility that an owner can make a mistake because there's no restriction on input reserve balance.
PoC
POC Test:
Output:
As can be seen from the logs, three minting functions are denied due to zero reserve balance.
Mitigation
I'd suggest adding the minimum limit of reserve balance when creating an exchange.
The text was updated successfully, but these errors were encountered: