Introduction
We express our gratitude to the CarbonPath, Inc. team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
CarbonPath’s mission is to eliminate significant quantities of greenhouse gas (GHG) emissions by stopping the release of these climate change causing compounds at their source - oil and natural gas wells.
| title | content |
|---|---|
| Platform | Ethereum, BNB Chain, Arbitrum, Polygon, Optimism |
| Language | Solidity |
| Tags | ERC20 token, ERC721 token, Token Sale |
| Timeline | 15/02/2023 - 16/03/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/orgs/carbonpathio/repositories→ |
| Commit | 4e406bb3386b583f630e41b9e26bdbf09e70ea4d |
Review Scope
- Commit
- 4e406bb3386b583f630e41b9e26bdbf09e70ea4d
Audit Summary
10/10
100%
10/10
7/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 CarbonPath, Inc. |
| Audited By | Hacken |
| Website | https://www.carbonpath.io/→ |
| Changelog | 22/02/2023 – Initial Review |
| 16/03/2023 - Second Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for CarbonPath, Inc.
- Audited By
- Hacken
- Website
- https://www.carbonpath.io/→
- Changelog
- 22/02/2023 – Initial Review
- 16/03/2023 - Second Review
System Overview
CarbonPath is a system that helps to close old oil and natural gas wells. Each unique NFT token of the system represents a real-life well and each fungible token equals a tonne of sequestered carbon emissions. The protocol is designed to allow users to take part in the retirement of abandoned and orphaned wells that pollute the environment.
The files in the audit scope:
CarbonPathAdmin - a contract that handles different interactions with CarbonPathToken (CPCO2) and CarbonPathNFT and serves as an admin for both contracts. Users can buy CPC02 tokens and retire them for a certain well.
CarbonPathNFT - ERC721 token that bounds to a well. Contains the geolocation of a well and additional metadata.
CarbonPathToken - ERC20 mintable and burnable token that represents locked carbon emission.
Privileged roles
DefaultAdmin:
CarbonPathAdmin: can grant and revoke minter role, set receiver of CP fee, non-profit address, buffer pool address, seller address.
CarbonPathToken: can grant and revoke minter role.
Owner:
CarbonPathNFT: can set admin address.
Admin:
CarbonPathNFT: can set metadata and URI for a specific token, mint new tokens, and increase the amount of retired CPCO2 tokens.
Minter:
CarbonPathAdmin: can mint new tokens, update token URI and metadata.
CarbonPathToken: can mint, burn tokens.
Executive Summary
Documentation quality
The total Documentation quality score is 7 out of 10.
There are some gaps in the functional requirements (there is no explanation of the buffer pool and advanced mint amounts of the CPCO2 token).
Technical requirements are partially provided.
NatSpec comments are detailed.
Code quality
The total Code quality score is 10 out of 10.
The development environment is configured.
Code is well-written and designed.
Test coverage
Code coverage of the project is 100% (branch coverage).
Security score
Upon auditing, the code was found to contain 2 critical, 2 high, 6 medium, and 10 low severity issues. Out of these, 18 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 system is not adequately documented. It is difficult to determine compliance with requirements due to gaps in the requirements.
The system describes the sellerAddress (single address) used in the CarbonPathAdmin contract as the CarbonPath Wallets; the security of the CarbonPath Wallets functionality is not part of this audit.
The system relies on the security of the privileged roles’ private keys, which can impact the execution flow and security of the funds. We recommend those accounts to be at least ⅗ multi-sig.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-1098 | Requirements Violation | fixed | Critical | |
| F-2023-1097 | Requirements Violation | fixed | Critical | |
| F-2023-1100 | Undocumented Behavior | mitigated | High | |
| F-2023-1099 | Highly Permissive Role Access | mitigated | High | |
| F-2023-1106 | Inconsistent Data: Missing Event for Critical Value Update | fixed | Medium | |
| F-2023-1105 | Contradiction: Redundant Ownable | fixed | Medium | |
| F-2023-1104 | Inefficient Gas Model: SafeMath in Solidity ^0.8.0 | fixed | Medium | |
| F-2023-110 | Unscalable Functionality: Check Repetition | fixed | Medium | |
| F-2023-1102 | Unscalable Functionality: Check Repetition | fixed | Medium | |
| F-2023-1101 | Unscalable Functionality: Check Repetition | fixed | Medium |
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/orgs/carbonpathio/repositories→ |
| Commit | 4e406bb3386b583f630e41b9e26bdbf09e70ea4d |
| Whitepaper | Provided→ |
| Requirements | Provided→ |
| Technical Requirements | Provided→ |