Author | Joxes, Agusduha |
---|---|
Created at | 2025-01-28 |
Initial Reviewers | Josep Bove |
Needs Approval From | Matt Solomon, Kelvin Fichter |
Status | Implementing Actions |
This document covers the changes introduced by the addition of the Shared Lockbox design, a singleton contract that stores all ETH liquidity for a given set of interoperable chains. It addresses the ETH withdrawals problem by the introduction of SuperchainETHBridge. The following components are:
- Contracts:
- Introducing
SharedLockbox
: Stores all ETH liquidity for an interoperable graph. Only authorizedOptimismPortal
addresses can calllockETH
andunlockETH
. - Introducing
SuperchainConfigInterop
: A proxy and implementation contract on L1 that extends fromSuperchainConfig
. It tracks the official "mesh" of authorized chains and their protals using theSharedLockbox
and grants theclusterManager
the right to add new chains. - Updates to the
OptimismPortal2
: Contain thelockETH
andunlockETH
functions, enabled when theSharedlockbox
is used. - Updates to the
OptimismPortalInterop
: Extended functionality on top ofOptimismPortal2
to handle migrating its ETH liquidity to theSharedLockbox
and locking/unlocking.
- Introducing
Below are references for this project:
- Specs PR: ethereum-optimism/specs#465
- Implementation PR: ethereum-optimism/optimism#13144
Note that the inclusion of the dependency set in the fault-proof mechanism is relevant for the SharedLockbox
, and it must function prior to the migration process of the contracts (analyzed here) to secure state transitions and thus withdrawals when a chain is added to any dependency set. The discussion around its design and implementation is still ongoing.
🗂️ For more context about the Interop project, refer to the following docs:
- Description: If an attacker bypasses access controls for
unlockETH
, the deposit and withdrawal invariants can be broken, potentially resulting in the worst-case scenario of draining all ETH liquidity from theSharedLockbox
. - Risk Assessment: High.
- Potential Impact: Critical. Unauthorized ETH unlocking would result in a direct loss of ETH from the
SharedLockbox
. - Likelihood: Low. Access controls are specified in
if (!superchainConfig().authorizedPortals(msg.sender)) revert Unauthorized()
, but errors or misconfigurations remain possible.
- Potential Impact: Critical. Unauthorized ETH unlocking would result in a direct loss of ETH from the
- Mitigation: There should be tests for
lockETH
andunlockETH
checks. Access control must be strictly enforced, permitting only approvedOptimismPortal
contracts via theauthorizedPortals
mapping inSuperchainConfigInterop
. - Detection: Monitor
ETHUnlocked
events to verify consistency with authorized portal addresses. Set up alerts for suspected unauthorized activity from non-approved addresses. - Recovery Path(s): Pause the system through
SuperchainConfig
to halt theSharedLockbox
upon detection of unauthorized access.
- Description: The
clusterManager
role inSuperchainConfigInterop
is the entity in charge to calladdDependency
. If compromised, an attacker could add malicious or arbitrary chain IDs and authorize their own portal. - Risk Assessment: High.
- Potential Impact: Critical. A malicious addition to the dependency set could allow an attacker to
unlockETH
from theSharedLockbox
. - Likelihood: Low. The
clusterManager
should be a highly secured role (e.g., a multi-sig or governance key).
- Potential Impact: Critical. A malicious addition to the dependency set could allow an attacker to
- Mitigations: Tests to ensure
addDependency
cannot be called by unauthorized accounts. Strictly secure theclusterManager
key. - Detection: Track the
DependencyAdded
event for calls fromclusterManager
. Compare newly added chain IDs to an approved list. - Recovery Path(s): Pause the system through
SuperchainConfig
. Since removal functions are unavailable, an upgrade directly overSuperchainConfigInterop
to clear storage slots will be required.
- Description: In both
SharedLockbox
andOptimismPortalInterop
, the address of theSuperchainConfig
is stored in a special storage slot. If it’s set incorrectly or to a malicious address, the entire access-control scheme breaks. - Risk Assessment: High.
- Potential Impact: Critical. Since the entire access-control scheme depends on
SuperchainConfig
, all funds could potentially be extracted from theOptimismPortal
. - Likelihood: Low. Storage slots and values are carefully set during protocol upgrades.
- Potential Impact: Critical. Since the entire access-control scheme depends on
- Mitigations: There should be tests for the initialization step to ensure that
superchainConfig
is only set once, and the security team must validate—using a checklist-style review—that the storage slot forsuperchainConfig
is not unintentionally changed before any upgrade. - Detection: Implement a verification step in the OPCM scripts to check that the final
superchainConfig
address in newly deployed or upgraded contracts matches the expected address. - Recovery Path(s): Pause the system, to upgrade the contract to set
superchainConfig
correctly.
- Description: Smart contracts are typically audited based on their source code, assuming that the Solidity compiler (
solc
) produces a correct and verifiable output. Relying solely on source code audits, without verifying the actual bytecode, could introduce undetected vulnerabilities. - Risk Assessment: High.
- Potential Impact: Critical. If the Solidity compiler generates incorrect or exploitable bytecode, it could introduce a hidden attack vector.
- Likelihood: Low. The Solidity compiler is widely used and battle-tested, but compiler bugs have occurred in the past.
- Mitigations: Use a Solidity version that has been in production for at least 6 months per the Solidity Upgrades guidelines. Actively track Solidity compiler CVEs and from existing resources such as Solidity Security Alerts and Solidity Bugs Viewer to ensure the chosen compiler version remains robust and secure.
- Detection: Monitor for new vulnerabilities in the compiler and for emerging Solidity bugs.
- Recovery Path(s): Pause the system if a Solidity compiler bug is identified.
- Description: The
SharedLockbox
is a proxied contract, which means its implementation can be upgraded. While this provides flexibility for fixes and improvements, a buggy or malicious upgrade could introduce vulnerabilities that compromise all ETH liquidity. - Risk Assessment: High.
- Potential Impact: Critical. If an upgrade introduces a bug or an exploitable backdoor, all ETH stored in the
SharedLockbox
could be drained. - Likelihood: Low to Medium. Upgrades are controlled by Security Council, after governance approval. However, upgrade mistakes or compromised keys remain a risk.
- Potential Impact: Critical. If an upgrade introduces a bug or an exploitable backdoor, all ETH stored in the
- Mitigations: Refer to fma-generic-contracts, items applies to this case. Any new implementation must go through the audit and testing. Upgrades should not be regular in this contract and it should maintain minimal code. Upgrade procedures and keys must follows the proper security practices.
- Detection: Verify proxy and implementation contracts through automated checks in the superchain-ops task
- Recovery Path(s): Refer to fma-generic-contracts. Pause the system through
SuperchainConfig
to halt theSharedLockbox
.
- Description: The
SuperchainConfigInterop
limit the number of dependencies totype(uint8).max
(= 255). Once the set size reaches 255, any furtheraddDependency
call will revert. - Risk Assessment: Low.
- Potential Impact: Medium. Future expansions of the interoperable set are blocked.
- Likelihood: Low. 255 chains are already quite large, but could be a problem if the interoperable set wants to grow beyond that.
- Mitigations: There should be a defined path to upgrade to increase the type from
uint8
touint16
or another approach. Current dependency set size should be monitored. - Detection: A simple periodic check of
dependencySetSize
inSuperchainConfigInterop
should be sufficient to ensure the limit is not approaching. Reverts on calls toaddDependency
would indicate this issue. - Recovery Path(s): An upgrade over
SuperchainConfigInterop
is needed to support a larger capacity.
- Description: During the
migrateLiquidity
call, theOptimismPortalInterop
sets an internalmigrated = true
flag. If that flag is never set, the portal incorrectly tries to handle ETH locally (even though liquidity is already in theSharedLockbox
). - Risk Assessment: Low.
- Potential Impact: Medium. This situation will cause deposits and withdrawals to fail.
- Likelihood: Very Low. The logic is straightforward, so only an upgrade or a code bug might cause it.
- Mitigations: There should be tests for
migrateLiquidity
to set astrue
. - Detection: Check whether the
migrated
function is marked asfalse
afterETHMigrated
event is emitted. Watch for unexpected reverts on user withdrawals. - Recovery Path(s): Perform an upgrade to set the flag correctly.
- Check this box to confirm that these items have been considered and updated if necessary.
- Resolve all the comments.
- FM1: Provide tests. (Wonderland)
- FM1: Provide monitoring solutions.
- FM2: Provide tests. (Wonderland)
- FM2: Provide monitoring solutions.
- FM3: Provide tests. (Wonderland)
- FM3: Implement OPCM scripts that verify
superchainConfig
. - FM3: Ensure that the security team has a procedure in place to check storage slots before performing any upgrades.
- FM4: Ensure that the security team is aware of how sensitive
SharedLockbox
is to potential compiler bugs. - FM1, FM2, FM3, FM4, FM5: Consider potential options for implementing automated pause mechanisms for the
SharedLockbox
, given the impact of these failures modes. - FM7: Provide tests.
- Confirm the interop fault proofs are consistent with the Shared Lockbox and dependency set management implementation so that FM discussed are aligned with it and new ones aren’t expected.
The OptimismPortal2.sol
, OptimismPortalInterop.sol
, SharedLockbox.sol
, SystemConfigInterop.sol
, and SuperchainConfigInterop.sol
require an audit before production.