sherlock-audit / 2023-01-optimism-judging

22 stars 8 forks source link

ak1 - SystemConfig.sol : unsafe storage location use #313

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

ak1

low

SystemConfig.sol : unsafe storage location use

Summary

SystemConfig.sol contract uses the memory slot based on teh UNSAFE_BLOCK_SIGNER_SLOT to store the UnsafeBlockSigner .

the issue is , there are chances that the slot may occupy memory already.

This come across while reading the solidity docs. https://docs.soliditylang.org/en/v0.8.18/internals/layout_in_memory.html#:~:text=There%20are%20some,have%20unexpected%20results.

function _setUnsafeBlockSigner(address _unsafeBlockSigner) internal {
    bytes32 slot = UNSAFE_BLOCK_SIGNER_SLOT;
    assembly {
        sstore(slot, _unsafeBlockSigner)
    }
}

Vulnerability Detail

Impact

Code Snippet

https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/L1/SystemConfig.sol#L183-L188

Tool used

Manual Review, solidity help manual.

Recommendation

Clean the memory from the slot and update the value.