This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
Tendency - Deficient Implementation of redemptionDelayBlocks
Requirement
#33
Labels
Excluded
Excluded by the judge without consulting the protocol or the senior
Non-Reward
This issue will not receive a payout
Tendency
medium
Deficient Implementation of
redemptionDelayBlocks
RequirementSummary
The current system allows calling UbiquityPoolFacet::collectRedemption a block before the set
redemptionDelayBlocks
, allowing users to claim their redeemed collateral earlier than the set delayVulnerability Detail
Ubiquity
currently uses a two-step process of redeeming collateral for ubiquity dollars.Firstly UbiquityPoolFacet::redeemDollar is called, after a set number of blocks has passed UbiquityPoolFacet::collectRedemption is then called to receive the redeemed collateral.
Assuming
redemptionDelayBlocks
is currently set to5 blocks
, which means after redeeming via a call to redeemDollar, collecting of this redeemed collateral is to be allowed after the set delay period of5 blocks
has elapsed, i.e. from the6th block
. The problem with the current system is that it wrongly allows the collection of redemption from the last block, i.e. from the5th block
, so from our example, users can still collect their redeemed collateral one block earlier than the intended delay.I have added a runnable POC demonstrating the issue below:
Please add the below test to
packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol
, then run:Here are the logs:
Impact
The admin set
redemptionDelayBlocks
wouldn't work as expectedCode Snippet
https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol#L485-L492
https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/facets/UbiquityPoolFacet.sol#L107
https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/facets/UbiquityPoolFacet.sol#L196-L199
Tool used
Manual Review
Recommendation
update collectRedemption check to:
This will ensure collection of redemption can only occur after the set wait period.
The text was updated successfully, but these errors were encountered: