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

0rpse - token accounts are not verified against token_hash #164

Open
sherlock-admin2 opened this issue Oct 27, 2024 · 0 comments
Open

0rpse - token accounts are not verified against token_hash #164

sherlock-admin2 opened this issue Oct 27, 2024 · 0 comments
Labels
Sponsor Confirmed The sponsor acknowledged this issue is valid

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Oct 27, 2024

0rpse

High

token accounts are not verified against token_hash

Summary

In Solana vault's deposit and withdraw flows token accounts are not verified against token_hash, this makes it possible for an attacker to withdraw from or deposit to the vault any token but make it seem like its any other token.

Root Cause

In oapp_lz_receive.rs and deposit.rs, deposit_token account is not checked againts token_hash parameter, token accounts are not included in the message either.:
https://github.com/sherlock-audit/2024-09-orderly-network-solana-contract/blob/main/solana-vault/packages/solana/contracts/programs/solana-vault/src/instructions/oapp_instr/oapp_lz_receive.rs#L10-L146
https://github.com/sherlock-audit/2024-09-orderly-network-solana-contract/blob/main/solana-vault/packages/solana/contracts/programs/solana-vault/src/instructions/vault_instr/deposit.rs#L20-L176

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

  1. Attacker calls deposit with usdc_hash, for token accounts attacker chooses some other token that is worth less than usdc, but for the protocol it will seem an amount of usdc was deposited to the vault.
  2. After deposit process is done, withdrawal process can take place with the same parameters but this time specifying usdc accounts, attacker profits.
    This attack path assumes some amount of usdc is already deposited to the vault.

Impact

Loss of funds.

PoC

No response

Mitigation

deposit_token should be checked against the token_hash parameter.

@sherlock-admin3 sherlock-admin3 added Sponsor Confirmed The sponsor acknowledged this issue is valid and removed Sponsor Confirmed The sponsor acknowledged this issue is valid labels Oct 29, 2024
@sherlock-admin4 sherlock-admin4 changed the title Dandy Lavender Terrier - token accounts are not verified against token_hash 0rpse - token accounts are not verified against token_hash Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sponsor Confirmed The sponsor acknowledged this issue is valid
Projects
None yet
Development

No branches or pull requests

2 participants