Download audit report
This document presents the results of a security review conducted by Nethermind Security for JustanAccount contract.
The JustanAccount is a Solidity smart contract designed to enhance Ethereum account functionalities by integrating support for EIP-7702 and EIP-4337. These integrations enable features such as transaction batching, gas fee sponsorship, cross-chain owner synchronization, and advanced signature validation.
The audit comprises 371 lines of Solidity code. The audit was performed using (a) manual analysis of the codebase, and (b) automated analysis tools.
| Audit assessment | |
| Audit Type | Security Review |
| Initial Report | October 20, 2025 |
| Final Report | October 21, 2025 |
| Initial Commit | d6a7ed2483 |
| Final Commit | 1c309a1663 |
| Documentation Assessment | High |
| Test Suite Assessment | High |
Findings by severity
| # | Contract | LoC | Comments | Ratio | Blank | Total |
| 1 | src/MultiOwnable.sol | 115 | 176 | 153.0% | 41 | 332 |
| 2 | src/JustanAccountFactory.sol | 41 | 47 | 114.6% | 15 | 103 |
| 3 | src/JustanAccount.sol | 215 | 153 | 71.2% | 45 | 413 |
| Total | 371 | 376 | 101.3% | 101 | 848 |
| # | Finding | Severity | Update |
| 1 | EIP-7702 delegation allows front-running attack on account initialization | Critical | Fixed |
| 2 | Gas griefing via WebAuthn signatures | Low | Acknowledged |
| 3 | Stuck nonce can break cross-chain replayability | Info | Acknowledged |
| 4 | getUserOpHashWithoutChainId() uses unhashed name and version for domain separator | Info | Fixed |
The JustanAccount project is a smart contract account system designed to enhance the functionality of Ethereum accounts by integrating support for EIP-4337 (Account Abstraction) and EIP-7702 (delegated implementation for EOAs). The architecture is composed of three primary contracts: JustanAccountFactory, JustanAccount, and MultiOwnable.
The JustanAccountFactory contract serves as the deployment entry point. It utilizes the CREATE2 opcode to deploy minimal, gas-efficient ERC-1967 proxies for each new account. This approach ensures that account addresses are deterministic and consistent across all supported EVM chains, calculated from a salt derived from the initial owners and a nonce. All proxy instances point to a single, shared JustanAccount implementation contract.
The core of the system is the JustanAccount contract, which functions as the smart wallet itself. It inherits from a BaseAccount (for ERC-4337 compliance), MultiOwnable (for owner management), and ERC1271 (for signature validation). Its dual compliance with EIP-4337 and EIP-7702 allows it to operate either as a native smart contract account or as an extension that grants smart contract capabilities to an existing EOA.
Ownership and authorization are managed through the MultiOwnable logic. A key feature is its support for multiple owners of flexible types. Owners can be traditional 20-byte Ethereum addresses or 64-byte WebAuthn public keys (represented as x, y coordinates), enabling modern authentication methods.
The system offers several advanced features:
executeBatch() function allows multiple operations to be executed atomically in a single transaction, improving efficiency and user experience.executeWithoutChainIdValidation() function, which bypasses the chain ID check for a predefined whitelist of secure functions.The risk rating methodology used by Nethermind Security follows the principles established by the OWASP Foundation. The severity of each finding is determined by two factors: Likelihood and Impact.
Likelihood measures how likely the finding is to be uncovered and exploited by an attacker. This factor will be one of the following values:
When defining the likelihood of a finding, other factors are also considered. These can include but are not limited to motive, opportunity, exploit accessibility, ease of discovery, and ease of exploit.
Impact is a measure of the damage that may be caused if an attacker exploits the finding. This factor will be one of the following values:
When defining the impact of a finding, other factors are also considered. These can include but are not limited to data and state integrity, loss of availability, financial loss, and reputation damage. After defining the likelihood and impact of an issue, the severity is determined according to the table below.
| Impact / Likelihood | Low | Medium | High |
| High | Medium | High | Critical |
| Medium | Low | Medium | High |
| Low | Info / Best Practices | Low | Medium |
| Undetermined | Undetermined | Undetermined | Undetermined |
To address issues that do not fit a High, Medium or Low severity, Nethermind Security also uses three more finding severities: Informational, Best Practices, and Undetermined.
| File | Fix commit | Type | Status |
src/JustanAccount.sol | 19b002b | Critical | Fixed |
The JustanAccount contract is designed as an implementation template for an Externally Owned Account (EOA) to use via EIP-7702 delegation. This mechanism allows the EOA to execute the contract's logic in its own context, including the initialize(...) function which is used to set the initial owners of the account.
The initialize(...) function has external visibility and is intended to be called only once when the account logic is first used to set the owners. The only restriction on who can call it is a check that the account is not already initialized ( nextOwnerIndex() == 0).
function initialize(bytes[] calldata owners) external payable virtual {
//
if (nextOwnerIndex() != 0) {
revert JustanAccount_AlreadyInitialized();
}
_initializeOwners(owners);
}In an EIP-7702 flow, the EOA first signs a delegation tuple, which is then submitted to the network.
A malicious actor can observe the EOA's delegation tuple and/or the transaction initializing the contract in the mempool. If they submit a transaction to the EOA's address, calling the delegated initialize(...) function with the attacker's address as the owner, and this transaction is mined before the EOA's intended initialization, the attacker can successfully front-run the EOA.
Once the attacker's transaction is executed, they become the owner of the EOA's account logic in the EOA's context. The attacker can then call privileged functions, such as execute(...), to drain all Ether and ERC-20 tokens held by the victim EOA. This allows an attacker to seize control and steal all funds from any EOA that attempts to use the JustanAccount for EIP-7702 delegation.
Recommendation
Consider restricting the caller of the initialize(...) function to ensure that only the EOA being initialized can set its own owners in case of use of EIP-7702, or the factory contract for ERC4337.
Resolution
We've successfully addressed the front-running vulnerability in the initialize() function. Our solution restructures the deployment architecture: the JustanAccountFactory now deploys the JustanAccount implementation in its constructor and passes its own address as an authorized factory parameter. The initialize() function is now restricted to only accept calls from the authorized factory address, completely preventing unauthorized initialization attempts. For EIP-7702 EOAs, users add owners via self-calls to addOwnerAddress() or addOwnerPublicKey(), which are protected by the existing ownership checks that permit msg.sender == address(this).
| File | Fix commit | Type | Status |
src/JustanAccount.sol | — | Low | Acknowledged |
The JustanAccount contract is an ERC-4337 compliant smart contract account that validates UserOperations through its validateUserOp(...) function. The signature validation logic supports multiple schemes, including WebAuthn for owners with registered public keys. When a signature does not match the format of a standard ECDSA signature, it is processed as a potential WebAuthn signature.
The validation path for WebAuthn signatures is susceptible to a gas griefing attack. The core of the issue lies in the use of the WebAuthn.tryDecodeAuth(...) function , which is used to parse the WebAuthnAuth struct from the signature data. This decoding function successfully parses the struct even if arbitrary data is appended to a valid encoded payload. It does not enforce that the entire input byte array is consumed during the decoding process.
This allows an attacker to take a valid WebAuthn signature for a UserOperation and append a large amount of arbitrary data to it. When this bloated signature is submitted to the ERC-4337 EntryPoint, the account's validation logic will succeed because tryDecodeAuth(...) correctly decodes the valid portion of the signature while ignoring the appended data. By increasing the size of the signature field, the attacker forces the account owner or their paymaster to incur higher gas costs. This can be used to drain the account's gas deposit.
Recommendation
Consider adding a validation step to ensure that the length of the signatureData corresponds to a reasonably encoded WebAuthnAuth struct without extraneous data.
Resolution
We acknowledge this gas griefing vulnerability where a malicious bundler could append arbitrary data to a valid WebAuthn signature. However, the practical impact is inherently limited by ERC-4337's verificationGasLimit field, which caps the maximum gas consumption during signature verification.
| File | Fix commit | Type | Status |
src/JustanAccount.sol | — | Info | Acknowledged |
The JustanAccount contract implements a cross-chain replayability feature through the executeWithoutChainIdValidation(...) function. This functionality allows owner management operations to be executed across multiple chains with a single signature. To manage the nonces for these special operations, a constant key, REPLAYABLE_NONCE_KEY, is used. The validateUserOp(...) function checks if a UserOperation targets executeWithoutChainIdValidation(...) and ensures that the REPLAYABLE_NONCE_KEY is used for its nonce.
The ERC-4337 EntryPoint, which acts as a nonce manager, enforces strict sequential ordering for nonces associated with the same key. This means that for the REPLAYABLE_NONCE_KEY, UserOperations must be processed in the exact order of their sequence number (e.g., 0, 1, 2, ...).
The problem arises when a replayable UserOperation fails on one chain but succeeds on others. For instance, a user might broadcast a transaction to remove an owner across three different chains. If the account on one of those chains is in a state where the removal is invalid (e.g., the owner was never added on that chain, or it's the last owner), the UserOperation will revert. As a result, the EntryPoint will not increment the nonce for the REPLAYABLE_NONCE_KEY on that specific chain.
This creates a permanent desynchronization. All subsequent replayable operations with higher nonces will fail on the affected chain because the EntryPoint will reject them as being out of order. This effectively breaks the cross-chain synchronization feature for that account on that chain. This can be fixed by manually crafting and sending a separate transaction to call incrementNonce(...) on the EntryPoint contract.
Recommendation
Consider documenting this possibility and explaining the best practices to follow when doing owner management on JustanAccount contracts. Also document how to fix this scenario in case it is reached.
getUserOpHashWithoutChainId() uses unhashed name and version for domain separator| File | Fix commit | Type | Status |
src/JustanAccount.sol | e258c28 | Info | Fixed |
The getUserOpHashWithoutChainId(...) function is intended to compute a hash for a UserOperation that is valid across multiple chains by omitting the chainId from the EIP-712 domain separator . This allows for the replay of specific transactions, such as owner management, across different networks .
The function constructs the domain separator using the raw strings "ERC4337" and "1" for the name and version fields, respectively . This implementation deviates from the EIP-712 standard, which specifies that the string components of the EIP712Domain struct should be keccak256 hashed before being included in the final domain separator hash. The EIP712 contract inherited by EntryPoint correctly follows this standard by hashing the name and version when building its own domain separator .
This inconsistency means that any off-chain signer or wallet that correctly implements the EIP-712 specification will compute a different userOpHash than the one generated on-chain by getUserOpHashWithoutChainId(...). As a result, signatures may fail validation when processed by the JustanAccount contract for cross-chain operations, undermining the intended functionality.
function getUserOpHashWithoutChainId(PackedUserOperation calldata userOp) public view virtual returns (bytes32) {
bytes32 overrideInitCodeHash = Eip7702Support._getEip7702InitCodeHashOverride(userOp);
// @audit-issue The name "ERC4337" and version "1" are passed as raw strings instead of their keccak256 hashes.
return MessageHashUtils.toTypedDataHash(
keccak256(abi.encode(TYPE_HASH, "ERC4337", "1", 0, address(entryPoint()))),
userOp.hash(overrideInitCodeHash)
);
}Recommendation
Consider aligning the implementation of getUserOpHashWithoutChainId(...) with the EIP-712 standard by hashing the name and version strings before encoding them into the domain separator.
Resolution
The implementation has been corrected to properly comply with the EIP-712 standard by hashing the name and version string fields before encoding them into the domain separator.
Software documentation refers to the written or visual information that describes the functionality, architecture, design, and implementation of software. It provides a comprehensive overview of the software system and helps users, developers, and stakeholders understand how the software works, how to use it, and how to maintain it. Software documentation can take different forms, such as user manuals, system manuals, technical specifications, requirements documents, design documents, and code comments. Software documentation is critical in software development, enabling effective communication between developers, testers, users, and other stakeholders. It helps to ensure that everyone involved in the development process has a shared understanding of the software system and its functionality. Moreover, software documentation can improve software maintenance by providing a clear and complete understanding of the software system, making it easier for developers to maintain, modify, and update the software over time. Smart contracts can use various types of software documentation. Some of the most common types include:
These types of documentation are essential for smart contract development and maintenance. They help ensure that the contract is properly designed, implemented, and tested, and they provide a reference for developers who need to modify or maintain the contract in the future.
The JustaLab team provided a clear and comprehensive overview of the JustanAccount contract during the kick-off call. This was supported with written documentation detailing the different features present in the contracts.
All the relevant issues raised by the AuditAgent have been incorporated into this report. The AuditAgent is an AI-powered smart contract auditing tool that analyses code, detects vulnerabilities, and provides actionable fixes. It accelerates the security analysis process, complementing human expertise with advanced AI models to deliver efficient and comprehensive smart contract audits. Available at https://app.auditagent.nethermind.io.
| 139Tests passed | 0Failed |
The complete test output is in the full report.
As auditors, we recommend that any changes or updates made to the audited codebase undergo a re-audit or security review to address potential vulnerabilities or risks introduced by the modifications. By conducting a re-audit or security review of the modified codebase, you can significantly enhance the overall security of your system and reduce the likelihood of exploitation. However, we do not possess the authority or right to impose obligations or restrictions on our clients regarding codebase updates, modifications, or subsequent audits. Accordingly, the decision to seek a re-audit or security review lies solely with you.
This report is based on the scope of materials and documentation provided by you to Nethermind in order that Nethermind could conduct the security review outlined in 1. Executive Summary and 2. Audited Files. The results set out in this report may not be complete nor inclusive of all vulnerabilities. Nethermind has provided the review and this report on an as-is, where-is, and as-available basis. You agree that your access and/or use, including but not limited to any associated services, products, protocols, platforms, content, and materials, will be at your sole risk. Blockchain technology remains under development and is subject to unknown risks and flaws. The review does not extend to the compiler layer, or any other areas beyond the programming language, or other programming aspects that could present security risks. This report does not indicate the endorsement of any particular project or team, nor guarantee its security. No third party should rely on this report in any way, including for the purpose of making any decisions to buy or sell a product, service or any other asset. To the fullest extent permitted by law, Nethermind disclaims any liability in connection with this report, its content, and any related services and products and your use thereof, including, without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement. Nethermind does not warrant, endorse, guarantee, or assume responsibility for any product or service advertised or offered by a third party through the product, any open source or third-party software, code, libraries, materials, or information linked to, called by, referenced by or accessible through the report, its content, and the related services and products, any hyperlinked websites, any websites or mobile applications appearing on any advertising, and Nethermind will not be a party to or in any way be responsible for monitoring any transaction between you and any third-party providers of products or services. As with the purchase or use of a product or service through any medium or in any environment, you should use your best judgment and exercise caution where appropriate. FOR AVOIDANCE OF DOUBT, THE REPORT, ITS CONTENT, ACCESS, AND/OR USAGE THEREOF, INCLUDING ANY ASSOCIATED SERVICES OR MATERIALS, SHALL NOT BE CONSIDERED OR RELIED UPON AS ANY FORM OF FINANCIAL, INVESTMENT, TAX, LEGAL, REGULATORY, OR OTHER ADVICE.
The Leading Engineers of Blockchain Infrastructure