Closed howlbot-integration[bot] closed 3 months ago
It's true that we allow unaligned reads / writes, this is a known issue we are considering addressing.
However, the submission doesn't really demonstrate the issue - we already have reverts in the methods mentioned. And we already have memory proof checks. The suggested changes use a different revert style and add some additional proof checks that are incorrect.
Additionally, this issue is highlighted in the Cantina audit (3.3.2) - not sure if that invalidates this submission (I don't see the cantina audit listed in the rules).
Switching to confirmed after offline discussion because the unaligned read / write issue is real.
zobront marked the issue as satisfactory
zobront marked the issue as selected for report
This report is invalid, in all the calls to readMem
and writeMem
the effective address passed will have the two least significant bits zeroed, making them aligned
uint32 mem = readMem(a1 & 0xFFffFFfc, 1); // mask the addr to align it to 4 bytes
writeMem(a1 & 0xFFffFFfc, 1, mem);
There is indeed a problem with certain instructions not throwing an exception when the effective address is unaligned thus not adhering to MIPS spec, but that is described in https://github.com/code-423n4/2024-07-optimism-findings/issues/82 and not here.
This issue specifically focuses on readMem()
and writeMem()
, which are always called safely in the code as @Haxatron points out. Therefore, there is no situation in which the memory could be misaligned when these functions are called.
This is in contrast to issue #82, in which LH and LHU do not have this same guarantee, and is therefore valid.
For this reason, I will be marking this issue as Invalid.
zobront marked the issue as not selected for report
zobront removed the grade
zobront marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-07-optimism/blob/70556044e5e080930f686c4e5acde420104bb2c4/packages/contracts-bedrock/src/cannon/MIPS.sol#L538-L584 https://github.com/code-423n4/2024-07-optimism/blob/70556044e5e080930f686c4e5acde420104bb2c4/packages/contracts-bedrock/src/cannon/MIPS.sol#L592-L632
Vulnerability details
Impact
Proof of Concept
Tools Used
Manual review
Recommended Mitigation Steps
Ensure the alignment check is correctly implemented with a meaningful error message.
Ensure the proof verification logic is correct and provides meaningful error messages.
Assessed type
Math