Arbitrarily set rubiconMarketAddress
opens rug vector for admin or attacker with compromised keys
#372
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
Lines of code
https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/rubiconPools/BathToken.sol#L245-L247
https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/rubiconPools/BathHouse.sol#L286-L291
Vulnerability details
Impact
At any point, the owner of
BathHouse.sol
is able to change the address of the market contract by callingBathHouse.setBathTokenMarket()
which callsBathToken.setMarket()
. The new market address can be given max approval of all underlying tokens in theBathToken
contract through a call toBathToken.approveMarket()
. This creates a clear rug vector for the admin of the protocol, or any malicious user who has obtained compromised admin keys.Proof of Concept
BathToken.sol
rubiconMarketAddress
rubiconMarketAddress
over the underlying tokens in theBathToken.sol
contract.Tools Used
Manual review.
Recommended Mitigation Steps
Apply a timelock for large scale changes similar to this one. Allow the users 24 hours to be able to withdraw their underlying tokens before the market address change is put into effect.
The text was updated successfully, but these errors were encountered: