Skip to content
Business logic Audit finding Intermediate

Owner can set the feeRate to be greater than 100% and cause all future calls to exercise to revert

The owner can set the fee rate to a value greater than 100%, causing the subtraction in the exercise function to underflow and revert. This prevents buyers from exercising their options, allowing the owner to collect premiums without risk.

IllIllI Follow

Originally disclosed on Code4rena

Submitted by IllIllI, also found by 0xDjango, ACai, antonttc, BowTiedWardens, Cityscape, defsec, dipp, FSchmoede, GimelSec, gzeon, hickuphh3, hubble, joestakey, Kenshin, m9800, MiloTruck, RagePit, Ruhum, shenwilly, TomFrenchBlockchain, and WatchPug

Impact

The owner can force options to be non-exercisable, collecting premium without risking the loss of their NFT/tokens

Proof of Concept

After a buyer buys an option owned by the owner, the owner can change the fee rate to be close to type(uint256).max, which will cause the subtraction below to always underflow, preventing the exercise of the option. Once the option expires, the owner can change the fee back and wait for another buyer

File: contracts/src/Cally.sol   #1

288           // increment vault beneficiary's ETH balance
289           ethBalance[getVaultBeneficiary(vaultId)] += msg.value - fee;

https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L288-L289

Recommended Mitigation Steps

Add reasonable fee rate bounds checks in the setFee() function

outdoteth (Cally) confirmed and resolved:

this issue is fixed here; https://github.com/outdoteth/cally/pull/7


The original report as published on Code4rena, by IllIllI. 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 setFee function lacks an upper bound check, allowing the owner to set a fee rate that causes an underflow in the exercise calculation.

Impact

The owner can force options to be non-exercisable, collecting premium without risking the loss of their NFT/tokens.

What the attacker needed

Owner controls fee rate; buyer purchases an option

The fix

The issue was fixed by adding reasonable fee rate bounds checks in the setFee() function.

How it was found

  1. A buyer buys an option owned by the owner.
  2. The owner changes the fee rate to a very high value (close to type(uint256).max).
  3. The buyer attempts to exercise the option, but the transaction reverts due to underflow.
  4. After the option expires, the owner can change the fee back and wait for another buyer.

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 smart contract, the owner can set a fee that is so high that when a buyer tries to exercise their option, the calculation underflows (goes below zero) and the transaction fails. This means the buyer cannot exercise, but the owner keeps the premium paid.

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 IllIllI

View all

119 more disclosed reports, best first.

More from Cally 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.