Skip to content

Code4rena

Yield Witch v2 contest

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

disclosed reports
27
most reported class
Business logic
bug classes found
4
first disclosure
2021
Find Yield Witch v2 contest on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Yield Witch v2 contest chose to make public.

Business logic

Incorrect amount of Collateral moves for Auction

The auction calculation incorrectly moves the entire collateral and debt when the proportional amount falls below the minimum debt, instead of only increasing to the minimum. An attacker could cause a vault's full collateral to be auctioned when only a portion should be, potentially leading to loss of collateral for the user.

Yield Witch v2 contest

High
Business logic

Someone can create non-liquidatable auction if the collateral asset fails on transferring to address(0)

The auction function allows the auctioneer address to be set to address(0), and when the auctioneer reward is paid out, the token transfer to address(0) reverts on some tokens, making the auction impossible to liquidate. A malicious user could start an auction on their own underwater vault with a zero auctioneer to avoid liquidation and force the protocol to take on bad debt.

Yield Witch v2 contest

High
Audit finding

Oracle data feed is insufficiently validated

The smart contract's price oracle did not check whether the Chainlink price feed data was stale or from an incomplete round. An attacker could exploit this to get an incorrect quote amount, potentially leading to financial loss.

Yield Witch v2 contest

Medium
DoS

Rewards distribution can be disrupted by a early user

The reward accounting variable is stored as a 128-bit integer, and the calculation that updates it can exceed that range. An early user who wraps a tiny amount and then sends reward tokens to the contract could make the value overflow, disrupting reward distribution.

Yield Witch v2 contest

Medium
Business logic

Malicious Users Can Transfer Vault Collateral To Other Accounts To Extract Additional Yield From The Protocol

The ConvexYieldWrapper contract calculates a user's deposited balance by summing collateral across all vaults they own, but vault ownership can be transferred without updating checkpoints. An attacker can transfer a vault to another account and create a new checkpoint, allowing both accounts to claim yield on the same collateral, thereby extracting additional yield from the protocol.

Yield Witch v2 contest

High
Business logic

Malicious Users Can Duplicate Protocol Earned Yield By Transferring wCVX Tokens To Another Account

The ConvexYieldWrapper contract omitted a checkpoint on token transfers, so a user could transfer wCVX tokens to another account and manually checkpoint the recipient, causing both accounts to show the same deposited balance. This allowed the attacker to claim more than their fair share of rewards, draining yield from other users.

Yield Witch v2 contest

High
Audit finding

Rewards accumulated can stay constant and often not increment

The rewards accumulator can fail to increase when the reward rate is low relative to the token supply, because integer division rounds down to zero. An attacker could repeatedly transfer tokens to keep the time since last update very small, preventing rewards from ever accumulating.

Yield Witch v2 contest

High
Business logic

CompositeMultiOracle returns wrong decimals for prices?

The CompositeMultiOracle contract's price calculation functions may return incorrect prices due to a decimal scaling error. An attacker could potentially exploit this to inflate the value of a token when swapping, leading to incorrect amounts.

Yield Witch v2 contest

High
Business logic

No ERC20 safe* versions called

The claim function calls ERC20 transfer without checking the return value, so tokens that return false on failure are treated as successful transfers. Also, tokens like USDT that do not return a boolean cause the transaction to revert, making them unusable in the protocol.

Yield Witch v2 contest

Medium
Business logic

Rewards squatting - setting rewards in different ERC20 tokens opens various economic attacks.

The contract allows the rewards token to be changed, so users can front-run the change to claim old rewards if the new token is less valuable, or let their balance roll into the new token if it is more valuable. This creates an economic attack and prevents the protocol from later issuing a more valuable reward token.

Yield Witch v2 contest

Medium
Business logic

Exchange rates from Compound are assumed with 18 decimals

The CTokenMultiOracle contract assumed Compound exchange rates always have 18 decimals, but the actual scaling depends on the underlying token's decimals. This could cause incorrect token pricing.

Yield Witch v2 contest

High
Business logic

TimeLock cannot schedule the same calls multiple times

The TimeLock contract's schedule function reverts when the same target and data are used because the transaction hash is identical, preventing identical transactions from being scheduled multiple times. An attacker could not exploit this, but it caused a functional limitation for legitimate users needing recurring payments.

Yield Witch v2 contest

Medium
Business logic

ERC20Rewards breaks when setting a different token

The setRewards function allows changing the reward token, but unclaimed rewards from previous periods are paid in the new token without adjusting for decimals or value. An attacker could wait for a token with fewer decimals and claim a vastly larger amount.

Yield Witch v2 contest

High
Smart contracts

Use safeTransfer instead of transfer

The contract called the ERC20 transfer function without checking its return value, so a token that returns false on failure would not be detected. An attacker could exploit this to make transfers appear successful when they actually failed, potentially causing loss of funds or incorrect accounting.

Yield Witch v2 contest

Medium
Smart contracts

ERC20Rewards returns wrong rewards if no tokens initially exist

The ERC20Rewards contract fails to update the lastUpdated timestamp when totalSupply is zero, causing the first minter to receive all rewards accumulated since the rewards period started. An attacker could exploit this by minting the first token and claiming the entire reward pool.

Yield Witch v2 contest

High
Business logic

Uninitialized or Incorrectly set auctionInterval may lead to liquidation engine livelock

The auctionInterval state variable in the Cauldron contract is uninitialized and defaults to zero, and its setter does not validate the value. An attacker could repeatedly call grab to prevent auction prices from dropping, causing a livelock where liquidation engines keep re-grabbing vaults without progress.

Yield Witch v2 contest

Medium
DoS

Potential griefing with DoS by front-running vault creation with same vaultID

A user-chosen vault identifier can be front-run by an attacker who creates a vault with the same identifier, causing the victim's batch transaction to fail. This griefing attack prevents legitimate users from opening vaults and interacting with the protocol.

Yield Witch v2 contest

Medium
Business logic

User can redeem more tokens by artificially increasing the chi accrual

The chi oracle derives its exchange rate from Compound's stored exchange rate, which depends on total borrows and can be pushed up within a single transaction by a large borrow. An attacker could therefore redeem matured fyTokens for more underlying tokens than a normal redemption, paying only gas.

Yield Witch v2 contest

Medium
Business logic

Users can avoid paying borrowing interest after the fyToken matures

A user can avoid paying borrowing interest after maturity by giving their vault to the Witch contract and then buying all collateral with underlying tokens, because the auction price is calculated without accounting for accrued interest. This allows the user to repay debt without the interest, and could disincentivise timely repayment.

Yield Witch v2 contest

Medium
Business logic

Witch can’t give back vault after 2x grab

The Witch contract overwrites the stored original vault owner when a second grab occurs, so after the debt is sold the vault cannot be returned to the original owner. An attacker could exploit this to prevent the original owner from recovering their vault.

Yield Witch v2 contest

Medium
DoS

Possible DoS attack when creating Joins in Wand

The JoinFactory contract allows anyone to create a Join contract at a deterministic address using CREATE2, and an attacker can pre-deploy fake Joins for common assets to block the Wand from deploying the real ones. This causes a denial of service for the Wand's deployment process.

Yield Witch v2 contest

Medium
Access control

auth only works well with external functions

The auth modifier in AccessControl.sol checks msg.sig, which reflects the first function called in a transaction, not the current function. Thus, if a public function with auth is called internally from another function, the modifier checks authorisation for the caller function instead of the intended one, potentially allowing unauthorised access if such a call path exists.

Yield Witch v2 contest

Medium
Business logic

Duplication of Balance

The Cauldron contract's stir function caches balances before updating them, so a transfer to self incorrectly adds the transferred amount instead of leaving the balance unchanged. An attacker could duplicate any amount of ink or art, breaking the accounting system.

Yield Witch v2 contest

High
Access control

auth collision possible

The access control contract uses four-byte function selectors as role identifiers, so a function whose selector equals the root role's selector would grant root privileges. An attacker who could add a module with such a function could obtain full authorisation for the project.

Yield Witch v2 contest

High
Business logic

Violation of implicit constraints in batched operations may break protocol assumptions

The Ladle contract allows batched operations but does not enforce implicit constraints on operation order and multiplicity, such as requiring Join Ether to be first and Exit Ether to be last. An attacker or integrator could craft a batch that violates these constraints, potentially causing failed transactions, undefined behaviour, or loss/lock of funds.

Yield Witch v2 contest

Medium
Smart contracts

YieldMath.sol / Log2: >= or > ?

The log_2 function in YieldMath.sol used a strict greater-than comparison instead of greater-than-or-equal, causing incorrect rounding in the logarithm calculation. This could lead to a slightly different or unpredictable yield curve in Pool.sol, potentially allowing pools to be slowly drained over time.

Yield Witch v2 contest

High
Audit finding

Uniswap Oracle uses wrong prices

The Uniswap oracle contract used a mock with hard-coded prices, so the price could change from the set price and updating via set would be too slow and gas expensive. An attacker could potentially exploit the stale or incorrect price.

Yield Witch v2 contest

Medium