Skip to content
Business logic Audit finding Intermediate

All fund from Teller contract can be drained because a malicious receiver can call reclaim repeatedly

0xcrunch Follow with Jiamin, Juntao and 12 others

Originally disclosed on Sherlock

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

Found by

0xcrunch, Jiamin, Juntao, Kow, Musaka, Sm4rty, Yuki, berndartmueller, bin2chen, circlelooper, ctf_sec, kutugu, stuxy, tnquanghuy0512, tvdung94

Summary

All fund from Teller contract can be drained because a malicious receiver can call reclaim repeatedly

Vulnerability Detail

When mint an option token, the user is required to transfer the payout token for a call option or quote token for a put option

if after the expiration, the receiver can call reclaim to claim the payout token if the option type is call or claim the quote token if the option type is put

however, the root cause is when reclaim the token, the corresponding option is not burnt (code)

Solidity
       // Revert if caller is not receiver
        if (msg.sender != receiver) revert Teller_NotAuthorized();

        // Transfer remaining collateral to receiver
        uint256 amount = optionToken.totalSupply();
        if (call) {
            payoutToken.safeTransfer(receiver, amount);
        } else {
            // Calculate amount of quote tokens equivalent to amount at strike price
            uint256 quoteAmount = amount.mulDiv(strikePrice, 10 ** payoutToken.decimals());
            quoteToken.safeTransfer(receiver, quoteAmount);
        }

the Teller contract is likely to hold fund from multiple option token

a malicious actor can create call Teller#deploy and set a receiver address that can control by himself

and then wait for the option expiry and repeated call reclaim to steal the fund from the Teller contract

Impact

All fund from Teller contract can be drained because a malicious receiver can call reclaim repeatedly

Code Snippet

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

Tool used

Manual Review

Recommendation

Burn the corresponding option burn when reclaim the fund

Discussion

Oighty

Agree with this issue. Option tokens can't be burned with reclaim because they could be held by a large number of accounts. A simpler solution would be to store whether a specific option token has been reclaimed (in a mapping) and not allow that token to be reclaimed again.

ctf-sec

A simpler solution would be to store whether a specific option token has been reclaimed (in a mapping) and not allow that token to be reclaimed again.

Agree with the fix

Oighty

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

ctf-sec

Fix looks good, the fix use a map and revert if the receiver already claimed!

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

What is known

A high-severity business logic bug in Bond Options. Sherlock made it public on 13 July 2023. Found in the 99 audit contest (finding H-1), also found by 14 other wardens.

About Business logic

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

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 0xcrunch

View all

5 more disclosed reports, best first.

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.