Skip to content
Access control Audit finding Intermediate

Centralized risks allows rogue pool behavior in BathToken.

The BathToken contract trusts an admin-controlled BathHouse to approve pairs, and the admin can set themselves as an approved pair. This allows the admin to call rebalance and steal any tokens from the pool.

0x1f8b Follow

Originally disclosed on Code4rena

Submitted by 0x1f8b

Centralized risks allows rogue pool behavior.

Proof of Concept

The onlyPair modifier is as detailed below:

    modifier onlyPair() {
        require(
            IBathHouse(bathHouse).isApprovedPair(msg.sender) == true,
            "not an approved pair - bathToken"
        );
        _;
    }

And the bathHouse is the admin as you can see in the following comment in the initialize method

bathHouse = msg.sender; //NOTE: assumed admin is creator on BathHouse

So if the admin it’s able to be the a valid pair (it could change the owner with setBathHouse), the owner it’s able to call the method rebalance and steal any token.

Affected source code:

Recommended Mitigation Steps

  • Use timeLock, or avoid admin accounts.

bghughes (Rubicon) acknowledged and commented:

Acknowledged centralization risk #344 #314

HickupHH3 (judge) commented:

The attack path could have been more detailed. It is valid though:

  • set bathHouse to malicious bathHouse contract to always return true for the onlyPair modifier check
  • rug funds by specifying own wallet as destination in rebalance()

It’s different from #211’s attack vector, hence keeping it separate.


The original report as published on Code4rena, by 0x1f8b. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the admin can replace the BathHouse contract with a malicious one that always approves the admin as a pair, and the admin can then call rebalance to send tokens anywhere.

Impact

The admin could steal any token held by the pool.

What the attacker needed

Admin privileges

The fix

The report recommends using a time lock or avoiding admin accounts; the project acknowledged the centralisation risk.

How it was found

  1. The admin sets the bathHouse address to a malicious contract that always returns true for isApprovedPair.
  2. The admin calls rebalance with their own wallet as the destination to steal tokens.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract pool lets users deposit tokens. The pool checks with a separate admin contract to see if a caller is allowed to move funds. If the admin can make that check always pass for themselves, they can move all the tokens out. This is a centralisation risk because one privileged account has too much power.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by 0x1f8b

View all

21 more disclosed reports, best first.

More from Rubicon v2

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.