Open hats-bug-reporter[bot] opened 1 year ago
The fee for a year will be calculated correctly during "He minted 900 osETH as well". Before Sam mints 900 osETH, the protocol will update his yearly fee
Hey @tsudmi, not sure what do you mean by that. would you please explain it in better example? I would like it to be in detail not just general describing. the issue is about reducing the fees for 90 osETH not 900, the flash loan is to assist what already minted before to avoid the fees for it (point .2)
Github username: @evokid Submission hash (on-chain): 0x9fea796990c8d463bc986fb64e22a52ed0500f20c3731e7bc97921043f499521 Severity: high
Description: Class High
Description
cumulativeFeePerShare of _osToken is responsible to add the treasury fee to the position in the protocol. However, there is a specific scenario that can attacker use to avoid paying the right treasury fee according to his osETH holding time.
as we realize in burnOsToken() the treasury fee will be calculated for the whole time that user hold until burning the osETH token, but this could be manipulated by the scenario below and pay less treasury fee to the protocol.
Attack Scenario
Sam deposited 100 ETH in the vault token
He minted 90 osETH tokens since he can get 90% of the staked ETH in osETH.
One year passed 360 days with holding osETH tokens.
Now Sam wants to manipulate treasury fee that he should pay when burning his osETH .
Sam create a contract and include next actions in one transaction:
He gets a Flash loan of 1k ETH
Sam deposited 1k ETH in the vault
He minted 900 osETH as well
What done in the protocol now that
_totalShares
of osETH token increased in huge value.Sam burns his 90 osETH (point 2)
Sam paid the treasury fee for 90 ETH which deceased far from the right value to pay for 360 days because
_totalShares
is too high.Now Sam burn 900 osETH.
Sam redeem from the Vault to pay back the flash loan.
Because
_totalShares
had a big increase, the protocol will calculate less treasury fees of 360 days period to the attacker to pay which is considered as an abuse to the protocol fees.Attachments
cumulativeFeePerShare()
which calls _unclaimedAssets() L336must calculate the correct profitAccrued to calculate treasury shares later in
cumulativeFeePerShare()
L216-L245but the attacker decreased what he must pay by the attack scenario mentioned above, which become less far from the expected or correct value.
Recommendations: