Introduction
We express our gratitude to the Neptune Mutual team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
Neptune is a marketplace for parametric cover to protect users’ digital assets from security and custody risks.
title | content |
---|---|
Platform | EVM |
Language | Solidity |
Tags | Liquidity Pool |
Timeline | 01/09/2023 - 23/10/2023 |
Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
---|---|
Repository | https://github.com/neptune-mutual-blue/periphery/→ |
Commit | e90464d07b425f5f1a85959e1c196a0a8ae43282 |
Review Scope
- Commit
- e90464d07b425f5f1a85959e1c196a0a8ae43282
Audit Summary
10/10
100%
9/10
9/10
The system users should acknowledge all the risks summed up in the risks section of the report
Document Information
This report may contain confidential information about IT systems and the intellectual property of the Customer, as well as information about potential vulnerabilities and methods of their exploitation.
The report can be disclosed publicly after prior consent by another Party. Any subsequent publication of this report shall be without mandatory consent.
Document | |
---|---|
Name | Smart Contract Code Review and Security Analysis Report for Neptune Mutual |
Audited By | Hacken |
Website | https://neptunemutual.com/→ |
Changelog | 08/09/2023 - Initial Review |
09/10/2023 - Second Review | |
23/10/2023 - Third Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Neptune Mutual
- Audited By
- Hacken
- Website
- https://neptunemutual.com/→
- Changelog
- 08/09/2023 - Initial Review
- 09/10/2023 - Second Review
- 23/10/2023 - Third Review
System Overview
Neptune Mutual is a liquidity pool protocol with the following contracts:
LiquidityGaugePool — a protocol that manages deposits to the liquidity pool and distribution of NPM token rewards to users who contribute liquidity to the protocol and engage in staking.
LiquidityGaugePoolController — an abstract contract that is inherited by LiquidityGaugePool to manage pool info registries.
LiquidityGaugePoolReward — an abstract contract that is used by LiquidityGaugePool to calculate rewards and update voting powers.
LiquidityGaugePoolState — an abstract contract to be used as storage of variables.
Privileged roles
The admin of the LiquidityGaugePool can:
pause/unpause the contract
set all the pool info
The NSROLESPAUSER role of LiquidityGaugePool_ contract can:
pause the contract
The NSROLESRECOVERYAGENT role of the LiquidityGaugePool contract can:
recover/withdraw assets (except staking and reward tokens) from the contract
Executive Summary
Documentation quality
The total Documentation quality score is 9 out of 10.
Functional requirements are provided.
Technical description is provided.
NatSpec format was missing.
Code quality
The total Code quality score is 9 out of 10.
Style guide is violated.
The development environment is configured.
Test coverage
Code coverage of the project is 100% (branch coverage).
Deployment and basic user interactions are covered with tests.
Although the coverage tool result is sufficient, interactions by several users are not tested thoroughly. For instance, withdrawing rewards from different users and comparing the results is missing.
Security score
Upon auditing, the code was found to contain 0 critical, 9 high, 3 medium, and 2 low severity issues. Out of these, 9 issues have been addressed and resolved, leading to a Security score of 10 out of 10.
All identified issues are detailed in the “Findings” section of this report.
Summary
The comprehensive audit of the customer's smart contract yields an overall score of 9.7. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
The LiquidityGaugePool relies on external contracts for reward calculation, which were not part of this audit. Any vulnerabilities, changes, or unexpected behaviors in these external contracts can directly impact the reward distribution in the LiquidityGaugePool. Users and the platform might face inaccurate or unintended reward distributions due to external dependencies.
Every user has to wait at least a minimum 100-block waiting period after each deposit before they can withdraw funds. Even if users have previously deposited assets, the waiting period is calculated based on the most recent deposit for all.
Findings
Code ― | Title | Status | Severity | |
---|---|---|---|---|
F-2023-0711 | Unrestricted Token Recovery | fixed | High | |
F-2023-0710 | Highly Permissive Owner Access | fixed | High | |
F-2023-0709 | Mishandled Edge Case | mitigated | High | |
F-2023-0708 | Highly Permissive Owner Access | fixed | High | |
F-2023-0707 | Missing Storage Gaps | fixed | High | |
F-2023-0706 | Undocumented Functionality | mitigated | High | |
F-2023-0705 | Denial Of Service; Highly Permissive Owner Access | fixed | High | |
F-2023-0704 | Unverifiable Logic | accepted | High | |
F-2023-0703 | Coarse-grained Access Control; Data Inconsistency | fixed | High | |
F-2023-0714 | Lack of Emergency Withdrawal Mechanism | fixed | Medium |
Identify vulnerabilities in your smart contracts.
Appendix 1. Severity Definitions
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, do not affect security score but can affect code quality score. |
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, do not affect security score but can affect code quality score.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
---|---|
Repository | https://github.com/neptune-mutual-blue/periphery/→ |
Commit | e90464d07b425f5f1a85959e1c196a0a8ae43282 |
Whitepaper | Not provided |
Requirements | Provided→ |
Technical Requirements | Provided→ |
Contracts in Scope
LiquidityGaugePool.sol
LiquidityGaugePoolController.sol
LiquidityGaugePoolReward.sol
LiquidityGaugePoolState.sol
interfaces/ILiquidityGaugePool.sol