Introduction
We express our gratitude to the Unizen team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
Unizen is a next-generation DEX aggregator, offering developers, traders, and businesses the ability to unlock unparalleled token swap capabilities.
Document | |
---|---|
Name | Smart Contract Code Review and Security Analysis Report for Unizen |
Audited By | Stepan Chekhovskoi |
Approved By | Ataberk Yavuzer |
Website | https://unizen.io→ |
Changelog | 27/01/2025 - Initial Report |
12/02/2025 - Second Report | |
Platform | Solana |
Language | Rust |
Tags | DeFi, DeX Aggregator |
Methodology | https://hackenio.cc/sc_methodology→ |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Unizen
- Audited By
- Stepan Chekhovskoi
- Approved By
- Ataberk Yavuzer
- Website
- https://unizen.io→
- Changelog
- 27/01/2025 - Initial Report
- 12/02/2025 - Second Report
- Platform
- Solana
- Language
- Rust
- Tags
- DeFi, DeX Aggregator
- Methodology
- https://hackenio.cc/sc_methodology→
Review Scope | |
---|---|
Repository | https://github.com/unizen-io/unizen-solana-swap→ |
Initial Commit | 653803a62fbe5c9ebb96c52d7cbeb4afec3eba10 |
Second Commit | a4592e0418b6a5afe26138822ae358e4c2c2b299 |
Review Scope
- Initial Commit
- 653803a62fbe5c9ebb96c52d7cbeb4afec3eba10
- Second Commit
- a4592e0418b6a5afe26138822ae358e4c2c2b299
Audit Summary
The system users should acknowledge all the risks summed up in the risks section of the report
Documentation quality
Functional requirements are missed.
Technical description is not provided.
Code quality
The code is well-structured.
The development environment is configured.
Test coverage
Code coverage of the project is 0%.
The protocol does not have any test cases.
System Overview
Unizen Solana Contract wraps Jupiter AMM swap functionality.
The contract implements optional fee mechanism which provides ability to integrate an off-chain service to cover Gas fees in arbitrary token.
The contract provides validation for swap minimum amount out.
Privileged roles
The contract owner is able to upgrade the functionality.
Potential Risks
System Reliance on External Contracts: The functioning of the system significantly relies on Jupiter AMM external contracts. Any flaws or vulnerabilities in these contracts adversely affect the audited project, potentially leading to security breaches or loss of funds.
Flexibility and Risk in Contract Upgrades: The project's contracts are upgradable, allowing the administrator to update the contract logic at any time. While this provides flexibility in addressing issues and evolving the project, it also introduces risks if upgrade processes are not properly managed or secured, potentially allowing for unauthorized changes that could compromise the project's integrity and security.
Integrator Specifies Zero Share Percent: The project introduces the integrator role for accounts executing transactions on behalf of the protocol users. The integrators may charge a fee for the service. The smart contract provides the ability for integrators to share the fee with the protocol development team. However, integrators may specify the fee-sharing as zero and not reward the protocol.
Misconfiguration of Jupiter Transactions: The integrators are allowed to provide arbitrary swap data to Jupiter AMM. Users should carefully validate the source and receive token accounts, check the swap and minimum output amounts.
Findings
Code ― | Title | Status | Severity | |
---|---|---|---|---|
F-2025-8517 | Inaccessible Functionality due to Read-Only Account | fixed | Medium | |
F-2025-8516 | Redundant Accounts in Context | fixed | Observation | |
F-2025-8511 | Redundant Lifetime Declarations | fixed | Observation |
Identify vulnerabilities in your smart contracts.
Appendix 1. Definitions
Severities
When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.
Reference on how risk scoring is done is available through the repository in our Github organization:
Severity | Description |
---|---|
Critical | Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation. |
High | High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation. |
Medium | Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category. |
Low | Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution. |
Severity
- Critical
Description
- Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.
Severity
- High
Description
- High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.
Severity
- Medium
Description
- Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.
Severity
- Low
Description
- Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution.
Potential Risks
The "Potential Risks" section identifies issues that are not direct security vulnerabilities but could still affect the project’s performance, reliability, or user trust. These risks arise from design choices, architectural decisions, or operational practices that, while not immediately exploitable, may lead to problems under certain conditions. Additionally, potential risks can impact the quality of the audit itself, as they may involve external factors or components beyond the scope of the audit, leading to incomplete assessments or oversight of key areas. This section aims to provide a broader perspective on factors that could affect the project's long-term security, functionality, and the comprehensiveness of the audit findings.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
---|---|
Repository | https://github.com/unizen-io/unizen-solana-swap→ |
Initial Commit | 653803a62fbe5c9ebb96c52d7cbeb4afec3eba10 |
Second Commit | a4592e0418b6a5afe26138822ae358e4c2c2b299 |
Whitepaper | N/A |
Requirements | https://docs.unizen.io→ |
Technical Requirements | README.md |
Scope Details
- Initial Commit
- 653803a62fbe5c9ebb96c52d7cbeb4afec3eba10
- Second Commit
- a4592e0418b6a5afe26138822ae358e4c2c2b299
- Whitepaper
- N/A
- Requirements
- https://docs.unizen.io→
- Technical Requirements
- README.md
Assets in Scope
Appendix 3. Additional Valuables
Additional Recommendations
The smart contracts in the scope of this audit could benefit from the introduction of automatic emergency actions for critical activities, such as unauthorized operations like ownership changes or proxy upgrades, as well as unexpected fund manipulations, including large withdrawals or minting events. Adding such mechanisms would enable the protocol to react automatically to unusual activity, ensuring that the contract remains secure and functions as intended.
To improve functionality, these emergency actions could be designed to trigger under specific conditions, such as:
Detecting changes to ownership or critical permissions.
Monitoring large or unexpected transactions and minting events.
Pausing operations when irregularities are identified.
These enhancements would provide an added layer of security, making the contract more robust and better equipped to handle unexpected situations while maintaining smooth operations.