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

Inspect try-catch clauses in solidity/random-beacon contracts #3758

Open
lukasz-zimnoch opened this issue Dec 14, 2023 · 0 comments
Open

Inspect try-catch clauses in solidity/random-beacon contracts #3758

lukasz-zimnoch opened this issue Dec 14, 2023 · 0 comments
Labels
👊 attack Possible attacks that may need investigation. ⛓️ solidity

Comments

@lukasz-zimnoch
Copy link
Member

Several solidity/random-beacon contracts use try-catch blocks as part of their business logic. However, the EVM has a call stack depth limit equal to 1024. A third-party contract can leverage this limitation and force the try-catch-ed calls to revert unconditionally, by using recursion and letting those calls be executed at depth 1025. In such a case, the control flow is passed to the catch clauses which may lead to undesired side effects. Possibly affected contracts/libraries are:

  • RandomBeacon
  • BeaconDkg

This issue is about inspecting the existing try-catch blocks and fixing them in case they are prone to the aforementioned problem. A possible fix is requiring that the caller is an EOA using the following check:

require(msg.sender == tx.origin, "Not EOA");

Existing deployments of the solidity/random-beacon contracts have to be upgraded once the random beacon becomes operable and starts creating groups.

Note: A similar problem was already fixed in the WalletRegistry contract living in the solidity/ecdsa package: #3756

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👊 attack Possible attacks that may need investigation. ⛓️ solidity
Projects
None yet
Development

No branches or pull requests

1 participant