Skip to content
Business logic Audit finding Intermediate

Design of BufferBinaryPool allows LPs to game option expiry

The BufferBinaryPool contract allows liquidity providers to withdraw their capital just before an option expires in-the-money, avoiding losses, or to deposit just before an out-of-the-money expiry to claim payouts with minimal risk. This lets LPs game option expiries at the expense of other LPs.

__141345__ Follow with 0x52

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-11-buffer-judging/issues/82

Found by

__141345__, 0x52

Summary

When an option is created, enough collateral is locked in BufferBinaryPool to cover a payout should it close ITM. As long as an LP isn't locked (trivially 10 minutes) and there is sufficient liquidity they can cash out their shares for underlying. The price and expiration of all options are public by design, meaning an LP can know with varying degrees of certainty if they will make or lose money from an option expiry. The result is that there will be a race to withdraw capital before any option expires ITM. LPs who make it out first won't lose any money, leaving all other LPs to hold the bags.

On the flip-side of this when there are large options expiring OTM, LPs will rush to stake their capital in the pool. This allows them to claim the payout while experiencing virtually zero risk, since they can immediately withdraw after 10 minutes.

Vulnerability Detail

See summary.

Impact

LPs can game option expiry at the expense of other LPs

Code Snippet

https://github.com/sherlock-audit/2022-11-buffer/blob/main/contracts/contracts/core/BufferBinaryPool.sol#L124-L126

Tool used

Manual Review

Recommendation

I strongly recommend an epoch based withdraw and deposit buffer to prevent a situation like this. Alternatively increasing lockupPeriod would be a quicker, less precise fix.

Discussion

bufferfinance

Yes we were planning to adjust the lockup accordingly.

bufferfinance

Doesn't need to be fixed. The admin will adjust the config accordingly.

0x00052

Fixed in PR#9

lockupPeriod is now set in constructor so that it is adjustable

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

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 pool allows deposits and withdrawals with only a short lockup period, so LPs can time their actions around option expiries to avoid losses or capture gains.

What the attacker needed

Sufficient liquidity in the pool; LP not locked (lockup period is short)

The fix

The lockup period was made adjustable in the constructor, but the report recommends an epoch-based withdraw and deposit buffer to fully prevent the issue.

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.

In this system, people called liquidity providers (LPs) put money into a pool that backs options trades. When an option is about to expire and would lose money for the pool, LPs can quickly take their money out before the loss hits, leaving other LPs to absorb it. Similarly, when an option is about to expire profitably for the pool, LPs can quickly add money to grab a share of the payout with almost no risk.

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 __141345__

View all

18 more disclosed reports, best first.

More from Buffer Finance

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.