Submitted by vlad_bochok
https://github.com/code-423n4/2022-08-mimo/blob/main/contracts/proxy/MIMOProxy.sol#L54
https://github.com/code-423n4/2022-08-mimo/blob/main/contracts/proxy/MIMOProxy.sol#L104
There is a function execute in MIMOProxy smart contract. The function performs a delegate call to the user-specified address with the specified data. As an access control, the function checks that either it was called by the owner or the owner has previously approved that the sender can call a specified target with specified calldata. See https://github.com/code-423n4/2022-08-mimo/blob/main/contracts/proxy/MIMOProxy.sol#L104.
The check itself:
The problem is how the selector is calculated. Specifically, calldataload(data.offset) - reads first 4 bytes of data.  Imagine data.length == 0, does it mean that calldataload(data.offset) will return bytes4(0)? No.
Lets see how calldata are accepted by functions in Solidity. The solidity function checks that the calldata length is less than needed, but does NOT check that there is no redundant data in calldata. That means, the function execute(address target, bytes calldata data) will definitely accept data that have target and data, but also in calldata can be other user-provided bytes. As a result,  calldataload(data.offset) can read trash, but not the data bytes.
And in the case of execute function, an attacker can affect the execution by providing trash data at the end of the function. Namely, if the attacker has permission to call the function with some signature, the attacker can call proxy contract bypass check for signature and make delegate call directly with zero calldata.
Please see proof-of-concept (PoC), getAttackerCalldata returns a calldata with which it is possible to bypass check permission for signature. Function execute from PoC simulate check for permission to call signatureWithPermision, and enforce that data.length == 0. With calldata from getAttackerCalldata it works.
Any account that has permission to call at least one function (signature) to the contract can call fallback function without permission to do so.
Add require(data.length >= 4);.
RayXpub (Mimo) commented:
gzeoneth (judge) commented:
gzeoneth (judge) commented:
RayXpub (Mimo) confirmed 
horsefacts (warden) reviewed mitigation:
