The parseEnableModeData
contains an error in the calculation and usage of offsets when parsing packed data. This error ccould cause incorrect slicing of the userOpSignature
and may result in misinterpretation of user operation signatures.
Lets look at parseEnableModeData
function of the LocalCallDataParserLib
library. The function is made to parse packed data, typically from a user operation's signature, to extract various components including module type, module initialization data, enable mode signature, and user operation signature.
But theres a mismatch between how an offset is calculated and how its subsequently used. Specifically:
The function uses inline assembly to efficiently parse the packed data:
The p
variable is initially set to packedData.offset
and is then used to navigate through the packed data.
At the end of the assembly block, p
is calculated as:
This calculation makes p
a relative offset from packedData.offset
.
However, p
is then used as an absolute index when slicing packedData
:
This mismatch between relative offset calculation and absolute index usage leads to incorrect slicing of the userOpSignature
.
Impact: HIGH
The userOpSignature
may be sliced from an incorrect position in the packed data, leading to partial, incorrect, or completely missing signature data.
The ModuleManager.sol
contract uses the parseEnableModeData function in its _enableMode
method:
The userOpSignature
returned by parseEnableModeData
is likely to be incorrect due to the offset calculation issue. This means that ModuleManager.sol
is working with an incorrectly parsed signature.
Manual review
Modify the final calculation of p
in the assembly block to make it an absolute index:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.