# Orderly Network: unvalidated deposit token mints fake USDC

Orderly Solana vault deposit lacked a check that deposit_token matches allowed_token, letting attackers deposit worthless tokens and mint USDC on the destination chain.

- Payout: Audit contest
- Severity: high
- Program: Orderly Network
- Found by: 0rpse
- Disclosed: 2024-09-24
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-09-orderly-network-solana-contract-judging/issues/40
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-09-orderly-network-solana-contract%3AH-1
- Tags: area:web3 domain:web3 impact:funds-loss impact:integrity kind:contest platform:sherlock sev:high tech:solana technique:source-review vuln:access-control vuln:business-logic

**Target:** Solana vault deposit instruction (Anchor program)
**Root cause:** The Deposit struct and deposit/apply functions never constrain deposit_token.key() to equal allowed_token.mint_account, and deposit_params.token_hash is user-supplied with no link to the actual deposited mint.
**Steps:**
1. Attacker holds a worthless token (e.g. WIF/memecoin) and knows the USDC token_hash.
2. Call `solana_vault::deposit` with `deposit_token` = worthless mint, amount = 10,000, `deposit_params.token_hash` = USDC hash, and the vault's `allowed_token` (USDC) account.
3. transfer_token_ctx moves worthless tokens into vault_token_account; no mint equality check runs.
4. apply increments deposit_nonce and builds VaultDepositParams with the attacker-supplied USDC token_hash.
5. Message to the other chain credits attacker with 10,000 USDC.
**How found:** Code review of the Anchor Deposit account struct and deposit/apply handlers, noticing the allowed_token account was passed but never compared against the actual deposit_token mint, and that token_hash was fully user-controlled.
**Exploitation:** Deposit a near-zero-value token while claiming the allowed token's hash; the cross-chain message credits equivalent USDC on the destination chain, and the vault retains only worthless tokens. Repeatable to drain vault liquidity.
**Insight:** In cross-chain vault designs, the account struct often validates the 'allowed' config account but forgets to bind it to the actual token account being transferred; always check that the mint of the transferred token equals the configured allowed mint, and that any user-supplied token identifier (hash) is derived from the real mint rather than trusted.

