Skip to content
Access control Audit finding Intermediate

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

BakerFi mitigated:

PR-26

Status: Mitigation confirmed. Full details in reports from shaflow2 and 0xlemon.


The original report as published on Code4rena, by 0xlemon. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by 0xlemon

View all

4 more disclosed reports, best first.

More from BakerFi Invitational

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.