Skip to content
Business logic Audit finding Intermediate

FixedStrikeOptionTeller: create can be invoked when block.timestamp == expiry but exercise reverts

The create function allows minting option tokens when block.timestamp equals expiry, but the exercise function reverts at that same timestamp. An attacker could claim staking rewards at expiry, receiving option tokens that cannot be exercised, leading to a loss of funds.

Oxhunter526 Follow with TrungOre, berndartmueller and 3 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-06-bond-judging/issues/91

Found by

Oxhunter526, TrungOre, berndartmueller, ctf_sec, dopeflamingo, lil.eth

Summary

In FixedStrikeOptionTeller contract, new option tokens can be minted when block.timestamp == expiry but these option tokens cannot be exercised even in the same transaction.

Vulnerability Detail

The create function has this statement:

Solidity
        if (uint256(expiry) < block.timestamp) revert Teller_OptionExpired(expiry);

The exercise function has this statement:

Solidity
        if (uint48(block.timestamp) >= expiry) revert Teller_OptionExpired(expiry);

Notice the >= operator which means when block.timestamp == expiry the exercise function reverts.

The FixedStrikeOptionTeller.create function is invoked whenever a user claims his staking rewards using OTLM.claimRewards or OTLM.claimNextEpochRewards. (here)

So if a user claims his rewards when block.timestamp == expiry he receives the freshly minted option tokens but he cannot exercise these option tokens even in the same transaction (or same block).

Moreover, since the receiver do not possess these freshly minted option tokens, he cannot reclaim them either (assuming reclaim function contains the currently missing optionToken.burn statement).

Impact

Option token will be minted to user but he cannot exercise them. Receiver cannot reclaim them as he doesn't hold that token amount.

This leads to loss of funds as the minted option tokens become useless. Also the scenario of users claiming at expiry is not rare.

Code Snippet

https://github.com/sherlock-audit/2023-06-bond/blob/main/options/src/fixed-strike/FixedStrikeOptionTeller.sol#L267 https://github.com/sherlock-audit/2023-06-bond/blob/main/options/src/fixed-strike/FixedStrikeOptionTeller.sol#L336

Tool used

Manual Review

Recommendation

Consider maintaining a consistent timestamp behaviour. Either prevent creation of option tokens at expiry or allow them to be exercised at expiry.

Discussion

Oighty

Agree with the proposed solution. Will change the timestamp checks to be consistent.

Oighty

Fix implemented at https://github.com/Bond-Protocol/options/pull/6

ctf-sec

Fix looks great!

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

The create function checks if expiry is less than the current time, while exercise checks if the current time is greater than or equal to expiry, causing an inconsistency at the exact expiry timestamp.

Impact

Option tokens are minted but cannot be exercised, and the receiver cannot reclaim them, leading to a loss of funds.

What the attacker needed

User claims staking rewards at expiry

The fix

The timestamp checks were made consistent, as confirmed by the fix implementation.

How it was found

  1. A user claims staking rewards via OTLM.claimRewards or OTLM.claimNextEpochRewards when block.timestamp equals expiry.
  2. The claim triggers FixedStrikeOptionTeller.create, which mints new option tokens to the user.
  3. The user attempts to exercise the newly minted option tokens in the same transaction or block.
  4. The exercise function reverts because block.timestamp is greater than or equal to expiry.

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.

This is a smart contract bug where two functions disagree about when an option expires. One function lets you create options at the exact expiry moment, but another function won't let you use them at that same moment. So you can get tokens that are immediately useless, wasting your money.

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 from Bond Options

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.