Open sherlock-admin4 opened 1 month ago
Not valid here.
Please check below code. the has_one = rebate_authority is doing the check.
#[account(mut,
has_one = rebate_manager,
has_one = rebate_authority,
constraint = rebate_info.authority == rebate_manager.authority
)]
pub rebate_info: Account<'info, RebateInfo>,
0xeix
High
Anybody can claim rebate fees
Summary
In the current version of the
claim_rebate_fee
instruction, anybody can claim rebate fees as there is no constraints onclaim_fee_to_account
.Vulnerability Detail
Take a look at the
ClaimRebateFee
struct and its constraints:https://github.com/sherlock-audit/2024-08-woofi-solana-deployment/blob/main/WOOFi_Solana/programs/rebate_manager/src/instructions/claim_rebate_fee.rs#L8-35
As you can see here, the only requirement is for
claim_fee_to_account.mint == quote_token_mint.key()
. The other important requirement is forrebate_info.authority == rebate_manager.authority
. The problem is that these checks do not make sure that the signer is actually an authority, they just verify if the two instructions have the same authority and if themint
field of Account corresponds to thequote_token_mint.key()
. As per spec:Impact
This basically allows anybody to claim the fees instead of admin.
Code Snippet
Provided above.
Tool used
Manual Review
Recommendation
Introduce the following check (or another constraint):