-
Notifications
You must be signed in to change notification settings - Fork 0
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
In OptimismPortal.finalizeWithdrawalTransaction()
, the condition to revert the txn is incorrect.
#47
Comments
0xleastwood marked the issue as primary issue |
0xleastwood marked the issue as satisfactory |
0xleastwood marked the issue as selected for report |
The report doesn't explain if there is a vulnerability caused by using && over || . Please provide a POC if there is a vulnerability |
antojoseph marked the issue as sponsor disputed |
Reached out to warden via DM to request POC. |
POC provided by warden: The function Now as per the comments in code, the line
could fail every time under following conditions /* The amount of gas provided to the execution context of the target is at least the gas limit specified by the user. If there is not enough gas in the current context to accomplish this, and /* Perform a low level call without copying any returndata. This function will revert if the call cannot be performed with the specified minimum gas. */ Additionally, there are certain more scenarios I assume sponsor/devs should consider -
Now coming back to the IF condition -
In case if the That is, the If Similarly, by looking at code, I assume devs intented to revert function execution when caller was the ESTIMATION_ADDRESS. That's why I believe the correct condition would be to use || instead of && operator. Mitigation:
|
I agree with the warden, using |
With full respect to judge's expertise, I think this is a intended design decision in the documentation
Also, this exact finding is reported in previous auditing and the discussed extensively sherlock-audit/2023-01-optimism-judging#148
Moreover, you can see in this PR that is close to complete that Optimism did a ton of work to keep that lack of replayability in the portal: ethereum-optimism/optimism#5017 So I think this finding is QA finding Judge has the final authority, I will do no more dispute and respect judge's final decision |
I agree with @JeffCX |
This is not an issue as it follows the spec. |
As per the provided info, transactions which fail should not revert but instead be handled by the CDM. Marking as invalid. |
0xleastwood marked the issue as unsatisfactory: |
Lines of code
https://github.com/ethereum-optimism/optimism/blob/a48e53c100e6ac024f45be7bdec94ad35fe5cd1c/packages/contracts-bedrock/contracts/L1/OptimismPortal.sol#L405-L406
https://github.com/ethereum-optimism/optimism/blob/a48e53c100e6ac024f45be7bdec94ad35fe5cd1c/packages/contracts-bedrock/contracts/L1/OptimismPortal.sol#L417-L419
Vulnerability details
Impact
Medium Impact : Loss of withdrawn funds
Proof of Concept
In OptimismPortal.finalizeWithdrawalTransaction(), the condition to revert the txn is incorrect.
A call is made to
SafeCall.callWithMinGas()
https://github.com/ethereum-optimism/optimism/blob/a48e53c100e6ac024f45be7bdec94ad35fe5cd1c/packages/contracts-bedrock/contracts/L1/OptimismPortal.sol#L405-L406
and returned success value checked in following IF condition:
https://github.com/ethereum-optimism/optimism/blob/a48e53c100e6ac024f45be7bdec94ad35fe5cd1c/packages/contracts-bedrock/contracts/L1/OptimismPortal.sol#L417-L419
Here I believe, developer meant to use || instead of && in IF condition, either condition resulting true would revert the txn.
So, if success == false, then there is no need to check value of tx.origin, because txns should fail/revert anyway.
Tools Used
Manual
Recommended Mitigation Steps
Change the code to :
Assessed type
Other
The text was updated successfully, but these errors were encountered: