Skip to content

Code4rena

Canto v2 contest

Every publicly disclosed report for Canto v2 contest and what kind of bugs they were.

disclosed reports
14
most reported class
Access control
bug classes found
4
first disclosure
2022
Find Canto v2 contest on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Canto v2 contest chose to make public.

Business logic

Stableswap - Deadline do not work

The deadline check in the Stableswap periphery contract was disabled because the ensure modifier was commented out. An attacker (e.g., a miner) could delay a transaction indefinitely, causing the user to suffer maximum slippage.

Canto v2 contest

Medium
Smart contracts

getBorrowRate returns rate per year instead of per block

The getBorrowRate function in NoteInterest returns an annual rate instead of a per-block rate, while CToken's borrowRatePerBlock directly uses that value. This causes interest calculations to be massively inflated, leading to incorrect yield and loss of value.

Canto v2 contest

High
DoS

Deny of service in CNote.doTransferOut

The CNote contract's doTransferOut function requires the contract's token balance to be exactly zero after a transfer, so any extra token sent by an attacker causes the transaction to revert. An attacker can front-run a legitimate transfer with a small token amount to block withdrawals.

Canto v2 contest

High
Access control

Multiple initialization in NoteInterest

The initialize function in the NoteInterest contract can be called multiple times by the admin, allowing the admin to change the cNote and oracle addresses after initial setup. This could lead to undefined behaviour and potential loss of funds.

Canto v2 contest

Medium
DoS

Non view function is called with staticcall in CErc20Delegator

The CErc20Delegator contract uses a staticcall (delegateToViewImplementation) to call the non-view functions borrowRatePerBlock and supplyRatePerBlock, which now update state. After enough blocks have passed since the last update, these calls revert, making the functions unusable through the delegator.

Canto v2 contest

Medium
Business logic

AccountantDelegate: The sweepInterest function sweeps an incorrect number of cnote

The sweepInterest function transfers amtToSweep (a Note-denominated amount) instead of cNoteToSweep (the corresponding cNote amount) to the treasury. Since amtToSweep is normally larger than cNoteToSweep, the transfer often fails or reverts, leaving interest locked in the contract.

Canto v2 contest

High
Access control

Admin Can Break All Functionality Through Weth Address

The protocol's WETH address is used throughout its functionality, and if the admin mistakenly sets it to an incorrect address, users cannot claim rewards. An attacker with admin privileges could break the protocol by setting the WETH address to a wrong value.

Canto v2 contest

Medium
Business logic

Total supply can be incorrect in ERC20

The ERC20 token contract allowed the total supply to be initialised to a non-zero value without updating any user's balance, creating a permanent discrepancy between the reported total supply and the actual sum of balances. This could break integrations and market cap calculations.

Canto v2 contest

High
Audit finding

A cap is needed on the amount of Note than can be borrowed

The lending market has no cap on how much Note can be borrowed, so an attacker who manipulates the price of a collateral token against USDC could borrow unlimited Note and drain all Note-related value. The judge noted that the price of cNOTE itself is fixed at 1, but other tokens' prices can be manipulated, and rated the issue Medium.

Canto v2 contest

Medium
Audit finding

The LP pair underlying price quote could be manipulated

The price of an LP token was calculated from the pool's total value locked, which an attacker could inflate by dumping a large amount of a token into the pool. This could let a malicious user exploit the pool by manipulating the LP token price.

Canto v2 contest

High
Access control

Missing zero address check can cause initialize to be called more than once

The initialize function in AccountantDelegate.sol only checks that state variables are not zero, so if it is first called with zero addresses, it can be called again. An attacker with admin privileges could reinitialize the contract and change critical variables, potentially breaking all accounting.

Canto v2 contest

Medium
DoS

Deny of service in AccountantDelegate.sweepInterest

The sweepInterest function checks that the treasury's cnote balance is zero after redeeming, but this balance can be made non-zero by anyone sending a single cnote token to the treasury. An attacker could permanently block the sweepInterest function, preventing interest from being swept.

Canto v2 contest

High