Non-whitelisted recipient can receive shares
The vault's deposit, mint, withdraw, and redeem functions are restricted to whitelisted callers, but the receiver of shares is not checked against the whitelist. A non-whitelisted user can receive shares and later withdraw or redeem them through the VaultRouter, bypassing the whitelist.
0xlemon Follow with 0xlemon and MrPotatoMagic
Originally disclosed on Code4rena
Submitted by 0xlemon, also found by 0xlemon and MrPotatoMagic
https://github.com/code-423n4/2024-12-bakerfi/blob/main/contracts/core/VaultBase.sol#L237-L271
Summary
The recipient of the vault shares isn’t checked to be in the whitelist. This means that a non-whitelisted user can receive shares and then withdraw/redeem them throught the VaultRouter.
Vulnerability Details
If we look at VaultBase deposit/mint/withdraw/redeem functions have a onlyWhiteListed modifier that means they can only be called by someone who is within the _enabledAccounts. However the protocol doesn’t check if the receiver is included in that whitelist. This allows non-whitelisted people to receive shares and they can later easily withdraw them through the VaultRouter.
Impact
Bypass of the whitelist
Recommended mitigation steps
Check if the receiver of the vault shares is whitelisted
chefkenji (BakerFi) confirmed
Status: Mitigation confirmed. Full details in reports from shaflow2 and 0xlemon.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The access control modifier only checks the caller, not the receiver of vault shares.
Impact
A non-whitelisted user could bypass the whitelist and withdraw or redeem shares through the VaultRouter.
What the attacker needed
Non-whitelisted user; access to VaultRouter
The fix
The receiver of vault shares should be checked against the whitelist.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A whitelist is a list of allowed users. The vault lets only whitelisted users deposit or withdraw, but it forgets to check who receives the shares when they are transferred. So someone not on the list can still get shares and then cash them out, getting around the restriction.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.