Cally contest - Czar102's results

Earn yield on your NFTs or tokens via covered call vaults.

General Information

Platform: Code4rena

Start Date: 10/05/2022

Pot Size: $50,000 USDC

Total HM: 13

Participants: 100

Period: 5 days

Judge: HardlyDifficult

Total Solo HM: 1

Id: 122

League: ETH

Cally

Findings Distribution

Researcher Performance

Rank: 62/100

Findings: 2

Award: $63.10

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

8.1655 USDC - $8.17

Labels

bug
duplicate
2 (Med Risk)
sponsor confirmed

External Links

Lines of code

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

Vulnerability details

Fee is set by an admin and can be set maliciously to steal the funds that are entitled to go to the user.

Impact

Fee can be set to a maliciously high value to unfairly extract funds from protocol users. An owner can buy options, set fee to 100% and exercise options, paying only premium for tokens locked.

Additionally, the fee can be set to more than 100% causing a DoS of the exercise function, completely breaking contract's purpose. (the revertion happens when expression msg.value - fee underflows)

Tools Used

Manual analysis

Set an upper limit to the fee not to go unconstrained.

Add an agreedFee parameter to createVault(...) arguments and require it is the fee in the storage, then save it as a vault parameter.

#0 - outdoteth

2022-05-15T19:27:33Z

Low severity issues

Incorrect revert message

In contracts/src/Cally.sol#L169 the revert message is false - "Reserve strike too small". If reverts, it is too large. Additionally, a sharp inequality is used - someone may want just to present a price and skip the dutch auction - then equality would be useful.

Non-critical issues

Use !value instead of value == false

To increase readability, negate bool values instead of ensuring they are false. This is a best practice.

Cally.sol#L217

Cally.sol#L220

Cally.sol#L328

Economic calculations unnecessarily use approximations

In Cally.getDutchAuctionStrike(...) there are fixed-point calculations. At first progress is approximated, then used in calculations. It would be more precise to inline the calculation in the strike calculation.

Instead of:

        uint256 progress = (1e18 * delta) / AUCTION_DURATION;
        uint256 auctionStrike = (progress * progress * startingStrike) / (1e18 * 1e18);

write:

        uint256 auctionStrike = (delta * delta * startingStrike) / (AUCTION_DURATION * AUCTION_DURATION);

#0 - HardlyDifficult

2022-05-19T00:38:29Z

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter