Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powerful Stone Starling - If user overpays for priceFeed update he will not be refunded #882

Open
sherlock-admin2 opened this issue Dec 9, 2024 · 0 comments

Comments

@sherlock-admin2
Copy link

Powerful Stone Starling

Medium

If user overpays for priceFeed update he will not be refunded

Summary

When user overpays for overpaid amount of the price update in the pyth oracle, the overpaid amount will not be refunded

Root Cause

In the updatePrice when the user submit extra amount of eth, he will not be refunded.

uint fee = pythOracle.getUpdateFee(priceUpdate);
 @>>      pythOracle.updatePriceFeeds{value: fee}(priceUpdate);

        IPyth.Price memory price = pythOracle.getPriceNoOlderThan(
            tokenId,
            uint256(uint64(noOlderThan))
        );
        

Internal pre-conditions

No response

External pre-conditions

User overpays for fee and he expects extra fee to be returned

Attack Path

No response

Impact

Extra amount paid by the user remains in the contract, if the user overpaid by a big amount he will be saddened by this event.

PoC

No response

Mitigation

Consider returning the extra fee to the user.

.     .    . 
uint fee = pythOracle.getUpdateFee(priceUpdate);
        pythOracle.updatePriceFeeds{value: fee}(priceUpdate);

        IPyth.Price memory price = pythOracle.getPriceNoOlderThan(
            tokenId,
            uint256(uint64(noOlderThan))
        );
uint extraValue = msg.value - fee;
msg.sender.call(value: extraValue)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant