Open hats-bug-reporter[bot] opened 2 months ago
Accounting of tokens per each user is not needed, because it's accounted via stROSE
.
A user mints 100 stROSE and receives staking rewards via wstROSE
ERC4626 vault.
When user wants to exit, he unwraps wstROSE
into stROSE
and requests withdrawal into ROSE
.
If needed, multisig admin undelegates tokens to meet withdrawal request from user – the calculation of the exact amount is not needed, multisig admin can unstake slightly more to make sure user will be able to withdraw in full.
Github username: @4gontuk Twitter username: 4gontuk Submission hash (on-chain): 0xb325be032a5ec3b0a2b0a7aae34d675ac01214f2bb251068aeaf0d32b39b5a39 Severity: medium
Description:
Description:
The
stROSEMinter
contract handles the delegation and undelegation of tokens using shares. Theundelegate
andtakeReceiptUndelegate
functions are responsible for initiating and finalizing the undelegation process, respectively. However, these functions fail to properly account for the conversion between shares and token amounts, which can lead to significant discrepancies in the token amounts received by users.Relevant Components:
stROSEMinter
Contract:Subcall
library to interact with the Oasis Runtime SDK.Subcall
Library:Functions in Play:
stROSEMinter::undelegate
Function:undelegationReceipts
mapping.stROSEMinter::takeReceiptUndelegate
Function:Root Cause:
The root cause of the issue is the failure to convert shares back to the actual token amount during the undelegation process. This can lead to discrepancies as the value of shares can change over time due to rewards or slashing.
Highest Impact Scenario:
Impact
This bug can lead to significant discrepancies between the expected and actual amounts of tokens undelegated. Users might receive more or fewer tokens than they should, potentially leading to loss of funds or unfair distribution of rewards. This can undermine user trust and the overall token economics of the protocol.
Attack Scenario:
stROSEMinter::delegate
to delegate 100 ROSE and receives 100 shares.stROSEMinter::undelegate
to undelegate 50 shares.stROSEMinter::takeReceiptUndelegate
to finalize the undelegation.Proof of Concept
Delegation:
Undelegation:
Finalizing Undelegation:
takeReceiptUndelegate
to finalize the undelegation.