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

No check for external call in tailoff as such malicious strategists could call any external contract from any address #144

Closed
code423n4 opened this issue May 27, 2022 · 4 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 sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/rubiconPools/BathPair.sol#L535-L563

Vulnerability details

Without the check on _stratUtil address, malicious strategist could arbitariry add any corrupt address which will cause rebalance() in IBathToken to transfer() filledAsset to that malicious contract. That fake strategistUtility could also create fake function which makes it comply to the interface.

The lack of check could result in the stealing of exceeded assets that cannot get swapped back without incuring the loss during rebalancing.

Right now current strategists need to get approved by the BathHouse which may assure that this exploit will not happen to a certain degree but, in the future, as the project growing, the need for decentralized strategists will rise and the check for the strategist will be the minimum requirement.

proof of concept

1.Malicious strategist creates fake IStrategistUtility with similar function to real IStrategistUtility

2.Malicious strategist input the address of fake IStrategistUtility in _stratUtil of tailOff() in BathPair

3.tailOff() then call rebalance() in the IBathToken

4.rebalance() after calculating stratReward transfer filledAsset to fake IStrategistUtility

5.tailOff() will then call UNIdump() in fake IStrategistUtility, resulting in nothing happening and filledAsset getting stolen.

Mitigation

The contract owner should add some check or whitelist over the external address to make sure that the assets will only be sent to a verified address

@code423n4 code423n4 added 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 labels May 27, 2022
code423n4 added a commit that referenced this issue May 27, 2022
@bghughes bghughes added duplicate This issue or pull request already exists sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons labels Jun 3, 2022
@bghughes
Copy link
Collaborator

bghughes commented Jun 3, 2022

Duplicate of #113 #344

@bghughes bghughes closed this as completed Jun 3, 2022
@HickupHH3
Copy link
Collaborator

Duplicate of #157

@HickupHH3 HickupHH3 marked this as a duplicate of #157 Jun 17, 2022
@HickupHH3
Copy link
Collaborator

Centralisation risk issue: #344

@HickupHH3
Copy link
Collaborator

duplicate of #211

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 sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

3 participants