Skip to content
Business logic Audit finding Intermediate

Owner can modify the feeRate on existing vaults and steal the strike value on exercise

The contract owner can change the fee rate at any time, including after vaults are created. By setting a very high fee rate, the owner can take almost all of the exercise payment that should go to the option seller.

IllIllI Follow

Originally disclosed on Code4rena

Submitted by IllIllI, also found by Adam, 0x52, 0xf15ers, 0xsanson, berndartmueller, Bludya, BondiPestControl, catchup, crispymangoes, Czar102, eccentricexit, ellahi, GimelSec, hake, horsefacts, hubble, joestakey, Kumpa, pedroais, peritoflores, reassor, shenwilly, shung, smilingheretic, sseefried, and throttle_

Owner can steal the exercise cost which should have gone to the option seller

Proof of Concept

There are no restrictions on when the owner can set the feeRate:

File: contracts/src/Cally.sol   #1

117       /// @notice Sets the fee that is applied on exercise
118       /// @param feeRate_ The new fee rate: fee = 1% = (1 / 100) * 1e18
119       function setFee(uint256 feeRate_) external onlyOwner {
120           feeRate = feeRate_;
121       }

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

By using a rate that consumes the exercise cost, the owner can steal Ether from the seller:

File: contracts/src/Cally.sol   #2

282           uint256 fee = 0;
283           if (feeRate > 0) {
284               fee = (msg.value * feeRate) / 1e18;
285               protocolUnclaimedFees += fee;
286           }
287
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#L282-L289

The owner can wait for a particularly large-value NFT, snipe that one option, then retire

Recommended Mitigation Steps

Fix the fee rate per vault during vault creation

outdoteth (Cally) confirmed and resolved:

issue is fixed here: https://github.com/outdoteth/cally/pull/8

HardlyDifficult (judge) commented:

This is a valid concern. The owner could abuse this to capture much more ETH than was intended. It assumes that the owner is malicious or compromised and does not introduce any more risk than an upgradeable contract would have.


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

The fee rate is not fixed per vault at creation and can be changed by the owner at any time, including after vaults are created.

Impact

The owner could steal the exercise cost that should have gone to the option seller, but this requires a malicious or compromised owner.

What the attacker needed

Malicious or compromised owner

The fix

The fee rate should be fixed per vault during vault creation.

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 smart contract has an owner who can change settings. Here, the owner can change the fee percentage whenever they want. If they set it very high just before someone exercises an option, they can take almost all the money that should go to the person who sold the option.

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.