Fit Canvas Pangolin - In the deposit() function, due to the lack of a check on deposit_token, an attacker can use the Mint of any token to replace the Mint of USDC. #95
It can be observed that there is no check or constraint on deposit_token.
Although there are related checks for allowed_token, such as requiring allowed_token.allowed == true, deposit_params is a user input parameter. A user could set deposit_params.token_hash to usdc_hash, but this is not actually linked to the USDC Mint.
As a result, an attacker can use the minting of any arbitrary token instead of USDC’s Mint, allowing them to deposit worthless tokens in place of USDC. When there is USDC deposited by other users in the vault_token_account, the attacker can initiate a withdrawal request and take out the USDC.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
1. The attacker uses a worthless Token Mint to perform a deposit (with all other parameters set correctly).
2. They wait until there is USDC in the vault_token_account from other users’ deposits (or USDC added by the protocol).
3. They initiate a withdrawal to take out the USDC.
Impact
The protocol has lost valuable tokens, specifically USDC.
Fit Canvas Pangolin
High
In the deposit() function, due to the lack of a check on deposit_token, an attacker can use the Mint of any token to replace the Mint of USDC.
Summary
In the deposit() function, due to the lack of a check on deposit_token, an attacker can use the Mint of any token to replace the Mint of USDC.
Root Cause
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#L22
It can be observed that there is no check or constraint on deposit_token.
Although there are related checks for allowed_token, such as requiring allowed_token.allowed == true, deposit_params is a user input parameter. A user could set deposit_params.token_hash to usdc_hash, but this is not actually linked to the USDC Mint.
As a result, an attacker can use the minting of any arbitrary token instead of USDC’s Mint, allowing them to deposit worthless tokens in place of USDC. When there is USDC deposited by other users in the vault_token_account, the attacker can initiate a withdrawal request and take out the USDC.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
Impact
The protocol has lost valuable tokens, specifically USDC.
PoC
No response
Mitigation