Skip to content

Code4rena

Rubicon v2

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

disclosed reports
89
most reported class
Business logic
bug classes found
6
first disclosure
2022
Find Rubicon v2 on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Rubicon v2 chose to make public.

Business logic

Incorrect reward duration extension in notifyRewardAmount function

The notifyRewardAmount function always extends the reward period by the full rewardsDuration when new rewards are added, even if a period is already ongoing. This causes rewards to be distributed over a longer time than intended, giving users smaller rewards per time.

Rubicon v2

Medium
Smart contracts

Attack on rounding errors to get risk free profit

The RubiconMarket buy function rounds down the spend amount, allowing attackers to repeatedly buy small quantities and pay less than the exact proportional cost. This can yield a risk-free profit, especially for tokens with few decimals like WBTC and GUSD, as demonstrated in tests.

Rubicon v2

Medium
Business logic

Some offers can’t be cancelled

An offer created through the inherited SimpleMarket offer function is not added to the market's internal sorted or unsorted lists, so the overridden cancel function cannot find it and reverts. A user who creates an offer this way can never cancel it, leaving their funds locked in the offer.

Rubicon v2

High
Business logic

The _matcho() is not implemented properly

The _matcho() function in RubiconMarket does not account for the fee when calculating the amount to match, causing a revert when a taker's order is larger than the best offer. This leads to order matching failure, preventing the taker's order from being fulfilled.

Rubicon v2

Medium
DoS

Potential infinite loop in _borrowLimit function

The _borrowLimit function in the Position contract uses a while loop that can iterate an excessive number of times when the collateral factor is low, potentially causing the openPosition function to become unresponsive or fail. An attacker could exploit this to disrupt the system's performance and usability.

Rubicon v2

Medium
Audit finding

Zero reward rate calculation impedes low-decimals token distributions

The reward rate calculation in BathBuddy uses integer division, which can round down to zero for tokens with low decimals or short distribution periods. An attacker could exploit this to cause zero rewards to be distributed, forcing the owner to adjust parameters.

Rubicon v2

Medium
Business logic

The return value of buyAllAmount is incorrect

The buyAllAmount function returns the amount spent after subtracting the fee, rather than the gross amount actually spent. A caller relying on the return value would understate how much they paid, for example reporting 9,000 instead of 10,000 tokens spent.

Rubicon v2

Medium
Business logic

Incorrect fee handling in Position.sol's Market Buy / Sell functions

The market buy and sell functions in Position.sol incorrectly account for fees, which can lead to improper fee deductions and wrong trade execution. An attacker could potentially exploit this to cause incorrect trade amounts or fee losses.

Rubicon v2

Medium
Business logic

When opening a position, the collateral of the previous position is used for borrowing, which makes the user more easily liquidated

When a user opens a new leveraged position, the contract counts collateral from previous positions when calculating how much it can borrow, so the new position can be opened with less fresh collateral and ends up closer to the liquidation threshold. An attacker (or unlucky user) could therefore be liquidated after only a small price drop.

Rubicon v2

High
Smart contracts

FeeWrapper fails to handle ETH payment refunds

The FeeWrapper contract forwards ETH to a target contract but has no receive or fallback function, so any ETH refunded by the target causes the whole wrapped call to revert. This prevents users from wrapping calls to contracts that normally return unspent ETH.

Rubicon v2

High
Business logic

Wrong calculation of repayment amount in Position contract

The Position contract calculates the repayment amount using the current borrow rate per block, which can change over time, rather than the rate that applied when the position was opened. This can cause the calculated repayment to be higher or lower than the actual amount owed, leading to excess asset being swapped or insufficient repayment.

Rubicon v2

High
Business logic

Cannot close leveraged positions

The closePosition function attempts to repay the entire borrowed amount at once, which fails if the user lacks extra liquid assets because the leveraged position's collateral value is insufficient to cover the debt. An attacker could not exploit this, but users cannot close their leveraged positions without additional funds.

Rubicon v2

Medium
Business logic

Position contract allows to interact with positions that are liquidated

The Position contract does not check whether a position has already been liquidated before letting the user add more collateral. A user who calls increaseMargin after liquidation has their new collateral locked, because closePosition always reverts when it tries to redeem the larger bath token amount.

Rubicon v2

Medium
Business logic

A liquidated position possibly cannot be closed

The closePosition function attempts to close a margin position using the full original amount, ignoring any liquidation that reduced the position. An attacker could liquidate a position, after which the owner cannot close it, forcing manual recovery and risking mismanagement of other positions.

Rubicon v2

Medium
DoS

BathBuddy rewards DoS

The BathBuddy reward calculation rounds down to zero when the time between reward updates is very short, so a user with a small bathToken balance earns nothing. An attacker can repeatedly call getReward to refresh the global update time, blocking rewards for small liquidity providers indefinitely.

Rubicon v2

Medium
Business logic

Use of block.number leads to incorrect interest calculations

Interest owed on a borrowed position is calculated from the number of blocks elapsed rather than elapsed time, and on Optimism blocks are not produced at a constant rate. This means the interest a user repays can be higher than expected and the rate is manipulable.

Rubicon v2

Medium
DoS

Both buyAllAmountWithLeverage and sellAllAmountWithLeverage always revert

The functions buyAllAmountWithLeverage and sellAllAmountWithLeverage always revert because the internal _maxBorrow function requires positive liquidity, but a newly created Position contract has zero liquidity. An attacker can transfer a tiny amount of bathToken to the Position contract to trigger the revert, preventing users from opening leveraged positions.

Rubicon v2

Medium
Smart contracts

First depositor bug on unmodified Compound fork

The CToken implementation has a first depositor bug where an attacker can inflate the exchange rate by directly transferring underlying tokens, causing subsequent depositors to receive fewer shares. This allows the attacker to steal funds from depositing users and, because only one market per underlying can be created, bricks the BathHouse.

Rubicon v2

High