-
Notifications
You must be signed in to change notification settings - Fork 2
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
Oracle is payer of liquidation transaction fee #12
Comments
piske-alex (sponsor) confirmed |
alcueca marked the issue as satisfactory |
alcueca marked the issue as selected for report |
Hi @rvierdiiev It is not possible to let the trader pay the fee unless the transaction is signed by the trader. Why would the trader sign a transaction that will lead to liquidate their position? This will lead simply to DoS liquidation. I don't see this an issue here. Oracle which is the only signer should hold funds in order to be able to send TXs to the chain. Or additional account (controlled by the protocol only) which holds funds to pay for the fee. Which takes us back to the same point that, a controlled account by the protocol should hold the funds (Oracle or additional signer). |
When i said trader, i meant owner of trading pool and not position holder. |
Could I get a PoC that if the oracle doesn't hold funds then the liquidations don't work? Otherwise, I'll mark this as invalid. |
Sure @alcueca From solana docs: https://solana.com/docs/core/fees#fee-collection
In anchor, transaction signer is fetched by From solana docs: https://solana.com/docs/core/fees#fee-collection
|
Gotcha, then I assume that if we want the transaction to still be signed by the oracle, so that the liquidation price can be trusted, then |
The net effect of this issue is that Lavarage would need to provide an small amount of funds. Given that the average price per transaction in Solana is way below $1, this is a dust amount and negligible for the protocol. Users are not impacted. The result is no more than a deviation from expected design. |
alcueca changed the severity to QA (Quality Assurance) |
alcueca marked the issue as grade-a |
alcueca marked the issue as not selected for report |
@alcueca as result first liquidations would not work, before they figure this out and top up Oracle account |
Lines of code
https://github.com/code-423n4/2024-04-lavarage/blob/main/libs/smart-contracts/programs/lavarage/src/processor/liquidate.rs#L113
Vulnerability details
Proof of Concept
For
Liquidate
context oracle address is set as Signer. This means that this account will pay for the transaction. But this should not be like that, as protocol doesn't charge fees(only UI fees that can be omitted and any other UI can be built and used).Using oracle API users will be able to fetch transactions signed by oracle and then execute them. All of this txs fees should be paid by oracle. After discussing with sponsor i have found out that oracle account should not hold funds, which means that liquidations won't work.
Instead, traders should sign tx as well and pay for tx.
Impact
Oracle pays for tx, but should not and don't have funds.
Tools Used
VsCode
Recommended Mitigation Steps
Make trader pay the fee.
Assessed type
Error
The text was updated successfully, but these errors were encountered: