Skip to content
Business logic Audit finding Intermediate

No slippage control on deposit of IbbtcVaultZap.sol

The deposit function in IbbtcVaultZap.sol lacks slippage control, exposing users to sandwich attacks. An attacker could manipulate the pool to cause the user to receive fewer tokens than expected.

gzeon Follow

Originally disclosed on Code4rena

Submitted by gzeon, also found by WatchPug

Impact

There is no slippage control on deposit of IbbtcVaultZap.sol, which expose user to sandwich attack.

Proof of Concept

IbbtcVaultZap.sol L174 Any deposit can be sandwiched, especially when the pool is not balanced.

Recommended Mitigation Steps

Add a minOut in line with the mint function of other contacts, and pass it as a parameter on L174

The original report as published on Code4rena, by gzeon. 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

Likely the deposit function does not allow the caller to specify a minimum output amount, so the transaction is vulnerable to price manipulation.

Impact

An attacker could sandwich a user's deposit, causing the user to receive fewer tokens than expected, especially when the pool is unbalanced.

What the attacker needed

None

The fix

Add a `minOut` parameter to the deposit function and enforce it, similar to other contracts' mint functions.

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.

When you deposit tokens into a pool, the amount you get back can change if someone else trades just before and after you. This is called a sandwich attack. The report says the deposit function doesn't let you set a minimum amount you're willing to accept, so attackers can exploit this.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by gzeon

View all

46 more disclosed reports, best first.

More from BadgerDAO Zaps contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.