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 with unbounded loop #380

Open
code423n4 opened this issue Dec 1, 2021 · 2 comments
Open

DOS with unbounded loop #380

code423n4 opened this issue Dec 1, 2021 · 2 comments
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

Koustre

Vulnerability details

Impact

In UniswapHandler, in the function removeBuyer there is a for loop over an unbounded Buyers array, which if the buyers array gets too large can cause a denial of service and prevents the contract from being able to remove buyer roles from users/contracts. This would allow users/contracts to circumvent recovery mode and to continue to purchase and sell tokens using the contract.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

Tools Used

  • Manual Study

Recommended Mitigation Steps

  • remove unbounded for loop
@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Dec 1, 2021
code423n4 added a commit that referenced this issue Dec 1, 2021
@0xScotch 0xScotch added sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) labels Dec 8, 2021
@0xScotch
Copy link
Collaborator

0xScotch commented Dec 8, 2021

This will not allow circumventing recovery mode unless a malicious buyer is explicitly added by an admin. The bug doesn't impact funds but does impact protocol availability which by label definitions should be medium not high.

@GalloDaSballo
Copy link
Collaborator

The finding mentions an unbound loop on removeBuyer, if the array reaches too big of a size you could go over the gas limit for a block and as such any function would revert, that is possible.

However, this is an external function, as such bricking it would have no impact on the rest of the contract.

Additionally, because the protocol uses Uniswap, even if the protocol was bricked, the uniswap pools would still work.

Lastly, in the incredibly unlikely scenario of reaching the gas limit, bricking this function simply means you won't be able to remove Buyers from the protocol. Which would only impact the buyMalt function, which is just a utility function to buy from the Uniswap Pool.

As such the impact of the finding is effectively nil.

I will downgrade to Low Severity because the warden has shown a way to brick a function, but the economic and availability impact is not meaningful in my opinion

@GalloDaSballo GalloDaSballo added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants