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

DOS by Frontrunning BathHouse's initialize() Function #415

Closed
code423n4 opened this issue May 28, 2022 · 3 comments
Closed

DOS by Frontrunning BathHouse's initialize() Function #415

code423n4 opened this issue May 28, 2022 · 3 comments
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/migrations/2_protocol.js#L13-L41
https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/rubiconPools/BathHouse.sol#L97-L129

Vulnerability details

Impact

It's seen that the deployment scripts are ready to deploy RubiconMarket.sol, RubiconRouter.sol, BathHouse.sol.
And RubiconMarket is initialized at the time of deployment. However, BathHouse initialization is not done during deployment.It is important that the proxy contracts are deployed and initialized in the same transaction to avoid any malicious frontrunning.
As a result, a malicious attacker could monitor the Ethereum blockchain for bytecode that matches the BahtHouse contract and frontrun the initialize() transaction to gain ownership of the contract. This can be repeated as a Denial Of Service (DOS) type of attack, effectively preventing Rubicon's contract deployment, leading to unrecoverable gas expenses.

Proof of Concept

https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/rubiconPools/BathHouse.sol#L97-L129
https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/migrations/2_protocol.js#L13-L41

Tools Used

Manual Review

Recommended Mitigation Steps

it would be worthwhile to ensure the BathHouse.sol contract is deployed and initialized in the same transaction, or ensure the initialize() function is callable only by the deployer of the BathHouse.sol contract.

@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 disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) label May 30, 2022
@bghughes
Copy link
Collaborator

I believe this is low/no severity given that we will check all storage variables of the protocol via automated scripts to make sure the protocol is initialized correctly. If someone else called the initialize function, we would try again, and if front ran every time then an added storage variable for the appropriate caller would be added to ensure we can initialize the protocol correctly

@HickupHH3
Copy link
Collaborator

Agreed with sponsor, QA severity.

@HickupHH3
Copy link
Collaborator

Part of warden's QA report: #409

@HickupHH3 HickupHH3 added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Jun 16, 2022
@JeeberC4 JeeberC4 added the duplicate This issue or pull request already exists label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

4 participants