diff --git a/solana/modules/nft_bridge/program/src/api/complete_transfer.rs b/solana/modules/nft_bridge/program/src/api/complete_transfer.rs index 3d7e5c41c..7180d12cd 100644 --- a/solana/modules/nft_bridge/program/src/api/complete_transfer.rs +++ b/solana/modules/nft_bridge/program/src/api/complete_transfer.rs @@ -117,6 +117,9 @@ pub fn complete_native( if accs.vaa.to_chain != CHAIN_ID_SOLANA { return Err(InvalidChain.into()); } + if accs.vaa.to != accs.to.info().key.to_bytes() { + return Err(InvalidRecipient.into()); + } // Prevent vaa double signing accs.vaa.verify(ctx.program_id)?; @@ -227,6 +230,9 @@ pub fn complete_wrapped( if accs.vaa.to_chain != CHAIN_ID_SOLANA { return Err(InvalidChain.into()); } + if accs.vaa.to != accs.to.info().key.to_bytes() { + return Err(InvalidRecipient.into()); + } accs.vaa.verify(ctx.program_id)?; accs.vaa.claim(ctx, accs.payer.key)?; diff --git a/solana/modules/nft_bridge/program/src/lib.rs b/solana/modules/nft_bridge/program/src/lib.rs index ed04c171e..c19562f73 100644 --- a/solana/modules/nft_bridge/program/src/lib.rs +++ b/solana/modules/nft_bridge/program/src/lib.rs @@ -61,6 +61,7 @@ pub enum TokenBridgeError { WrongAccountOwner, TokenNotNFT, InvalidAssociatedAccount, + InvalidRecipient, } impl From for SolitaireError { diff --git a/solana/modules/token_bridge/program/src/api/complete_transfer.rs b/solana/modules/token_bridge/program/src/api/complete_transfer.rs index 202196697..d115bca74 100644 --- a/solana/modules/token_bridge/program/src/api/complete_transfer.rs +++ b/solana/modules/token_bridge/program/src/api/complete_transfer.rs @@ -121,6 +121,9 @@ pub fn complete_native( if accs.vaa.to_chain != CHAIN_ID_SOLANA { return Err(InvalidChain.into()); } + if accs.vaa.to != accs.to.info().key.to_bytes() { + return Err(InvalidRecipient.into()); + } // Prevent vaa double signing accs.vaa.verify(ctx.program_id)?; @@ -237,6 +240,9 @@ pub fn complete_wrapped( if accs.vaa.to_chain != CHAIN_ID_SOLANA { return Err(InvalidChain.into()); } + if accs.vaa.to != accs.to.info().key.to_bytes() { + return Err(InvalidRecipient.into()); + } accs.vaa.verify(ctx.program_id)?; accs.vaa.claim(ctx, accs.payer.key)?; diff --git a/solana/modules/token_bridge/program/src/lib.rs b/solana/modules/token_bridge/program/src/lib.rs index 1ca9c6ae0..dc0302a00 100644 --- a/solana/modules/token_bridge/program/src/lib.rs +++ b/solana/modules/token_bridge/program/src/lib.rs @@ -64,6 +64,7 @@ pub enum TokenBridgeError { UninitializedMint, WrongAccountOwner, InvalidFee, + InvalidRecipient, } impl From for SolitaireError {