Platform: Code4rena
Start Date: 04/01/2023
Pot Size: $60,500 USDC
Total HM: 15
Participants: 105
Period: 5 days
Judge: gzeon
Total Solo HM: 1
Id: 200
League: ETH
Rank: 54/105
Findings: 2
Award: $81.33
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0x52
Also found by: 0xSmartContract, Deivitto, Diana, IllIllI, Koolex, Rolezn, SleepingBugs, V_B, adriro, betweenETHlines, cryptostellar5, oyc_109, peanuts
44.8261 USDC - $44.83
Judge has assessed an item in Issue #353 as 2 risk. The relevant finding follows:
06 UPGRADEABLE CONTRACT IS MISSING A __GAP[50] STORAGE VARIABLE TO ALLOW FOR NEW STORAGE VARIABLES IN LATER VERSIONS
#0 - c4-judge
2023-02-12T16:25:41Z
gzeon-c4 marked the issue as duplicate of #261
#1 - c4-judge
2023-02-12T16:25:54Z
gzeon-c4 marked the issue as satisfactory
🌟 Selected for report: 0xSmartContract
Also found by: 0x1f8b, 0xAgro, 0xdeadbeef0x, 0xhacksmithh, 2997ms, Atarpara, Bnke0x0, Diana, HE1M, IllIllI, Josiah, Kalzak, Lirios, MalfurionWhitehat, MyFDsYours, Raiders, RaymondFam, Rolezn, SaharDevep, Sathish9098, Udsen, Viktor_Cortess, adriro, ast3ros, betweenETHlines, btk, chaduke, chrisdior4, cryptostellar5, csanuragjain, giovannidisiena, gz627, hl_, horsefacts, joestakey, juancito, ladboy233, lukris02, nadin, oyc_109, pauliax, peanuts, prady, sorrynotsorry, zaskoh
36.5015 USDC - $36.50
Number of Instances Identified: 1
<address>.code.length
 can be used in Solidity >= 0.8.0 to access an account’s code size and check if it is a contract without inline assembly.
14: assembly { csize := extcodesize(account)
Number of Instances Identified: 3
tx.origin
 is a global variable in Solidity that returns the address of the account that sent the transaction.
Using the variable could make a contract vulnerable if an authorized account calls a malicious contract. You can impersonate a user using a third party contract.
This can make it easier to create a vault on behalf of another user with an external administrator (by receiving it as an argument).
257: address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver; 281: address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver; 511: require(owner == hash.recover(userOp.signature) || tx.origin == address(0), "account: wrong signature");
Number of Instances Identified: 2
16: assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("biconomy.scw.proxy.implementation")) - 1));
13: assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("biconomy.scw.proxy.implementation")) - 1));
All the contracts in scope should update the import usage.
Our Solidity code is also cleaner in another way that might not be noticeable: the struct Point. We were importing it previously with global import but not using it. The Point struct polluted the source code
 with an unnecessary object we were not using because we did not need it. This was breaking the rule of modularity and modular programming: only import what you need
 Specific imports with curly braces allow us to apply this rule better.
import {contract1 , contract2} from "filename.sol";
he functions that change critical parameters should emit events. Events allow capturing the changed parameters so that off-chain tools/interfaces can register such changes with timelocks that allow users to evaluate them and consider if they would like to engage/exit based on how they perceive the changes as affecting the trustworthiness of the protocol or profitability of the implemented financial services. The alternative of directly querying on-chain contract state for such changes is not considered practical for most users/usages.
Missing events and timelocks do not promote transparency and if such changes immediately affect users’ perception of fairness or trustworthiness, they could exit the protocol causing a reduction in liquidity which could negatively impact protocol TVL and reputation.
Number of Instances Identified: 2
Navigate to the following contracts:
__GAP[50]
 STORAGE VARIABLE TO ALLOW FOR NEW STORAGE VARIABLES IN LATER VERSIONSNumber of Instances Identified: 1
See this link for a description of this storage variable. While some contracts may not currently be sub-classed, adding the variable now protects against forgetting to add it in the future.
18-28 contract SmartAccount is Singleton, BaseSmartAccount, IERC165, ModuleManager, SignatureDecoder, SecuredTokenTransfer, ISignatureValidatorConstants, FallbackManager, Initializable, ReentrancyGuardUpgradeable
All the contracts in scope should update the import usage.
It is recommended that Solidity contracts are fully annotated using NatSpec for all public interfaces (everything in the ABI). It is clearly stated in the Solidity official documentation. In complex projects such as Defi, the interpretation of all functions and their arguments and returns is important for code readability and auditability.
https://docs.soliditylang.org/en/v0.8.15/natspec-format.html
If Return parameters are declared, you must prefix them with /// @return
.
Some code analysis programs do analysis by reading NatSpec details, if they can’t see the @return
 tag, they do incomplete analysis.
Include return parameters in NatSpec comments
Recommendation Code Style:
/// @notice information about what a function does /// @param pageId The id of the page to get the URI for. /// @return Returns a page's URI if it has been minted
When deploying contracts, you should use the latest released version of Solidity. Apart from exceptional cases, only the latest version receives security fixes. Furthermore, breaking changes as well as new features are introduced regularly. Latest Version is 0.8.17
Number of Instances Identified: 1
It should be validate instead of valiate
10: the validateUserOp MUST valiate the aggregator parameter, and MAY ignore the userOp.signature field.
Number of Instances Identified: 1
Code architecture, incentives, and error handling/reporting questions/issues should be resolved before deployment
255: // TODO: copy logic of gasPrice?
#0 - c4-judge
2023-01-22T15:42:39Z
gzeon-c4 marked the issue as grade-b
#1 - c4-sponsor
2023-02-09T12:30:52Z
livingrockrises marked the issue as sponsor confirmed
#2 - livingrockrises
2023-02-12T18:50:55Z
I don't understand the second point about using tx.origin
#3 - c4-sponsor
2023-02-12T18:51:01Z
livingrockrises requested judge review