Open hats-bug-reporter[bot] opened 3 weeks ago
In current design, it is intended behavior for commitPrice
to be unrestricted. That might even incentivizes the user to pay the gas fees to commit the price without waiting for authorized role to do that. So no issue.
Github username: -- Twitter username: -- Submission hash (on-chain): 0xf1c49fa43c2a0f6cef97c3c4311fad9a1a0d22feeb83d2e2f56d51689df2785c Severity: high
Description: Description\ The vulnerability exists in the price commitment and redemption process within the
YieldOracle
andInvestToken
contracts. Specifically, thecommitPrice
function updates thepreviousPrice
to the currentcurrentPrice
, and this updatedpreviousPrice
is used immediately in thesharesToAssets
conversion function for redeeming assets. This allows a user to manipulate the value ofpreviousPrice
to redeem more assets than they should, exploiting any increase in price without an adequate delay. Anyone can callcommitPrice
function.Attack Scenario\
updatePrice
function is called to update the prices and he can callcommitPrice
beforeredeem
.previousPrice
to convert their shares into a higher amount of assets than they are actually entitled to.Attachments
https://github.com/hats-finance/Euro-Dollar-0xa4ccd3b6daa763f729ad59eae75f9cbff7baf2cd/blob/c04ebafc3c6c48d612eb8df38ebd3e5b2ffa73a6/src/YieldOracle.sol#L91-L102
nextPrice - currentPrice >= 0
https://github.com/hats-finance/Euro-Dollar-0xa4ccd3b6daa763f729ad59eae75f9cbff7baf2cd/blob/c04ebafc3c6c48d612eb8df38ebd3e5b2ffa73a6/src/YieldOracle.sol#L183-L185
Result can be greater than before.
https://github.com/hats-finance/Euro-Dollar-0xa4ccd3b6daa763f729ad59eae75f9cbff7baf2cd/blob/c04ebafc3c6c48d612eb8df38ebd3e5b2ffa73a6/src/InvestToken.sol#L353-L360