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.
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:
The attack path could have been more detailed. It is valid though:
- set bathHouse to malicious bathHouse contract to always return true for the
onlyPairmodifier check- rug funds by specifying own wallet as destination in
rebalance()It’s different from #211’s attack vector, hence keeping it separate.
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
- The admin sets the bathHouse address to a malicious contract that always returns true for isApprovedPair.
- 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.