Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arbitrarily set rubiconMarketAddress opens rug vector for admin or attacker with compromised keys #372

Closed
code423n4 opened this issue May 28, 2022 · 2 comments
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

Comments

@code423n4
Copy link
Contributor

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 calling BathHouse.setBathTokenMarket() which calls BathToken.setMarket(). The new market address can be given max approval of all underlying tokens in the BathToken contract through a call to BathToken.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

  • Users deposit their underlying token into BathToken.sol
  • Admin changes the rubiconMarketAddress
  • Admin sets max approval for rubiconMarketAddress over the underlying tokens in the BathToken.sol contract.
  • Admin can do whatever they like with all the underlying tokens.

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.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels May 28, 2022
code423n4 added a commit that referenced this issue May 28, 2022
@bghughes bghughes added the duplicate This issue or pull request already exists label Jun 3, 2022
@bghughes
Copy link
Collaborator

bghughes commented Jun 3, 2022

Duplicate of #344

@bghughes bghughes marked this as a duplicate of #344 Jun 3, 2022
@bghughes bghughes closed this as completed Jun 3, 2022
@HickupHH3 HickupHH3 added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value and removed 3 (High Risk) Assets can be stolen/lost/compromised directly QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Jun 17, 2022
@HickupHH3
Copy link
Collaborator

Duplicate of #249

@HickupHH3 HickupHH3 marked this as a duplicate of #249 Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants