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

Adversary can cause malicious slashing of operators by creating malicous token and setting gas limit above chain block gas limit #505

Closed
code423n4 opened this issue Oct 25, 2022 · 5 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) responded The Holograph team has reviewed and responded 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-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/HolographOperator.sol#L301-L439

Vulnerability details

Impact

Operators maliciously slashed

Proof of Concept

A user can create a malicious token that when called by anyone other than themselves and the bridge use an extreme amount of gas. They create a bridge request with a gas limit higher than the block limit. If an operator tries to call execute they will always run out of gas. Meanwhile the malicious user can call the token for very little gas. The malicious user calls the request to slash the operator

Tools Used

Manual Review

Recommended Mitigation Steps

Ensure gas limit is not higher than destination block gas limit

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Oct 25, 2022
code423n4 added a commit that referenced this issue Oct 25, 2022
@Minh-Trng
Copy link

a low level call will retain some gas for the parent https://eips.ethereum.org/EIPS/eip-150 so the rest of the code should still be able to execute

@gzeoneth
Copy link
Member

gzeoneth commented Oct 28, 2022

If the gasLimit is above block/tx gas limit, this will always revert and no one can execute the job and no slashing can occur.

Also attacker need to pay gasPrice * gasLimit upfront which can be huge if the gasLimit is set to very high.

@gzeoneth gzeoneth added disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) invalid This doesn't seem right and removed disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) labels Oct 28, 2022
@gzeoneth gzeoneth added sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue and removed invalid This doesn't seem right labels Oct 31, 2022
@gzeoneth gzeoneth reopened this Oct 31, 2022
@gzeoneth
Copy link
Member

Can be a duplicate of #364

@0xA5DF
Copy link

0xA5DF commented Oct 31, 2022

#364 makes the attack cheaper, but even if #364 was fixed, the attack would still be possible, and as I've shown at #414 it can cost a few bucks to do it on Polygon and Avalanche.

@alexanderattar alexanderattar added the responded The Holograph team has reviewed and responded label Nov 7, 2022
@alexanderattar alexanderattar added the resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) label Nov 15, 2022
@gzeoneth
Copy link
Member

I don't think slashing is possible, the block gas limit issue is a dupe of #414

@gzeoneth gzeoneth added the duplicate This issue or pull request already exists label Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) responded The Holograph team has reviewed and responded sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

5 participants