Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses Sherlock issue 3, which outlines a reentrancy vulnerability that allows an attacker to bypass certain protections and, for example, change the Safe's fallbackHandler.
The fix is to modify the reentrancy guard logic to enforce that
HSG.checkTransaction
andHSG.checkAfterExecution
can only be called in that explicit order.Together with the existing logic enforcing that
HSG.checkTransaction
can only be called from withinSafe.execTransaction
, we now enforce thata)
HSG.checkTransaction
MUST be called exactly once per outer call toSafe.execTransaction
, andb)
HSG.checkAfterExecution
is always comparing the existing Safe state to the original/correct snapshot of the Safe state (since it MUST be called afterHSG.checkTransaction
andHSG.checkTransaction
cannot be called after itself)This PR updates some of the transient variable names to better describe their intent.