Rubicon contest - throttle's results

An order book protocol for Ethereum, built on L2s.

General Information

Platform: Code4rena

Start Date: 23/05/2022

Pot Size: $50,000 USDC

Total HM: 44

Participants: 99

Period: 5 days

Judge: hickuphh3

Total Solo HM: 11

Id: 129

League: ETH

Rubicon

Findings Distribution

Researcher Performance

Rank: 25/99

Findings: 4

Award: $455.59

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L605

Vulnerability details

Impact

Transfer function can succeed without an actual token transfer

Proof of Concept

BathToken can have an arbitrary ERC20 token as underlying. However, some tokens don't strictly follow ERC20 standard. For example, some tokens return bool confirmation during transfer(). Other tokens don't return and don't revert at all.

https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L605

Consider using safeTransfer() and checking balance before and after.

#0 - bghughes

2022-06-07T22:36:18Z

Duplicate of #316

Awards

1.8534 USDC - $1.85

Labels

bug
duplicate
2 (Med Risk)

External Links

Lines of code

https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L1231

Vulnerability details

Impact

Fee parameter is unbounded which can render unpredictable loss for users

Proof of Concept

There are no bound checks for fee parameter in RubiconMarket. It can go over 100%. https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L1231

Malicious admin could frontrun fee parameter change in a way that a user would lose all it's token funds (well over 100% of what is inside the pool)

Set meaningful bounds for tax parameter. Add timelock.

#0 - bghughes

2022-06-04T20:32:25Z

Duplicate of #125

#1 - HickupHH3

2022-06-18T04:38:11Z

Duplicate of #21

Findings Information

🌟 Selected for report: xiaoming90

Also found by: throttle

Labels

bug
duplicate
2 (Med Risk)
disagree with severity
sponsor disputed

Awards

401.6035 USDC - $401.60

External Links

Lines of code

https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L655-L675 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L612-624

Vulnerability details

Impact

Main Orderbook invariant is broken. User can post crossed order without it being filled.

Proof of Concept

https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L612-624

User can call function offer(uint256 pay_amt, ERC20 pay_gem, uint256 buy_amt, ERC20 buy_gem) and accidentally post an order which crosses the orderbook (buy order (sell) well above (below) market price).

In correctly implemented orderbook, such order would match against offers from orderbook. Here is no such case.

https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L655-L675 Theoretically keepers should put an order into orderbook but actually an arbitrage bot could call buy() and match that order at unfair price and then sell it. Zero risk profit.

This is high because user can lose funds and the offer() function is very natural to be called by users. There is no docs instructing users not to call this function.

Make sure the main orderbook invariant holds.

#0 - bghughes

2022-06-04T20:27:24Z

I believe this argument is the same as #110

#1 - HickupHH3

2022-06-22T16:14:34Z

Yeap, duplicate of #110. The case for loss of funds is gray; a user putting up an offer that is worse than the market rate would be under the classification of "user-error" bugs that typically see a medium severity.

Lines of code

https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathHouse.sol#L106

Vulnerability details

Impact

Centralization risk - admin has too much control over protocol.

Proof of Concept

The protocol defines an admin role, which can update almost any parameter in the protocol. Admin is not behind a multisig and changes are not behind a timelock. Even if protocol admins/developers are not malicious there is still a chance for admin keys to be stolen. In such case, an attacker could steal all the user's funds and kill the protocol.

https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathHouse.sol#L106

Try to redesign the protocol to be less centralized. Add support for multisig and timelock.

#0 - bghughes

2022-06-03T20:15:18Z

Company centralization is an acknowledged risk in the system in v1. See the future works section of our white paper ;)

#1 - HickupHH3

2022-06-15T14:44:35Z

It's great that wardens raise up rugpull vector concerns so that the sponsor is at least aware of it. I've deliberated much over how to best group these issues regarding centralization and owner privilege risks, and would like to explain my rationale and thought process.


Background

A precedent has been set from a previous contest finding where all issues were grouped together. Meanwhile, some wardens have pointed to the Insure contest where multiple high severity findings stem from the fact that a compromised owner is able to rug user funds through various means.

In this case, we have 2 groups of privileged access controls: the admin and the strategist(s). As it stands currently, the team is the sole strategist (stated in the future works section of the whitepaper), keeping the risk level the same as the admin. Different wardens have showcased how the admin and strategist is able to cause the loss of funds in multiple ways.

The README stated that "BathHouse has an admin that is the EOA administrator of the entire protocol in v1.", which in my opinion, favours the wardens' POV of the likelihood of rugpulling should the wallet be compromised. It is unclear if the admin and strategist shares the same EOA. In practice, I hope that they aren't.

I note that the strategists can potentially be increased in size, so the likelihood and risk of a malicious attack is greater in that regard.

On the other hand, the README stated the following:

Note that the Bath Token looks to both the Bath House (via onlyBathHouse) and the Bath Pair/strategists (via onlyPair) as permissioned actors. The Bath House admins key storage variables while strategists access funds and manage liquidity positions

The (weak) implication is that there is an acceptable trust assumption we can make about the admin and strategist(s). I am therefore in favour of keeping the medium severity rating for the issues raised.


Classification and thought process

The issues raised about rugpull vulnerabilities via centralisation risks can be broadly classified into 2 categories:

  1. Those that can be mitigated with contract modifications. Examples include:
  • ensuring upper / lower proper bounds on key variables (fees not exceeding max threshold, for instance)
  • adding safeguards and conditional checks (require statements)
  1. Those that can't be strictly enforced
  • Use multisig, put admin under timelock

While the premise is the same (assume strategist / admin is compromised), there is a spectrum in the write-up quality of issues. Some are generic in nature and are of low value, while others have written POCs and explained the potential impact in great detail.

It would be ideal and fair to reward wardens who provide meaningful context and details more than those who don't. Hence, in this regard, it makes sense to split up the issues based on the various attack vectors described by different ones.

Yet, there may be those who did spot these rugpull vulnerabilities, but chose not to mention them because of the privileged access and assumed that the risk was acceptable. I would like to encourage those who fall in this category (me being 1 of them :p) to raise these issues nonetheless, unless explicitly told otherwise / stated in the README that it is a trust assumption by the protocol / out of scope. Better to have your issue looked at and invalidated than not at all!


Verdict

Category 1 can be separated into the various attack vectors and actors (admin / strategist), as the mitigation is more tangible in nature. This way, the recommended fixes can also be easily identified and adopted. A warden that grouped multiple attack vectors together will have their issue made the primary issue; the rest will be marked as duplicates of it. Examples: #249 and #157

Regarding category 2, for issues that are generic "put admin under timelock" without explaining how and why a compromised owner / strategist can rug, as per the rulebook ruling and judges' general consensus, I will downgrade their severity to QA. Those that explained the impact and vulnerability in detail will be grouped together with medium severity because there isn't much that can be done about it.

#2 - HickupHH3

2022-06-17T15:44:47Z

This issue falls under cat 2 - generic timelock recommendation. Downgrading to QA

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