Introduction
We express our gratitude to the Alien.fun team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
Alien.fun is a decentralized platform built on blockchain technology that makes it easy to create, collect, and trade vanity tokens or meme coins entirely peer-to-peer (P2P).
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for Alien.fun |
| Audited By | David Camps Novi |
| Approved By | Grzegorz Trawinski |
| Website | https://www.alien.fun→ |
| Changelog | 27/09/2024 - Preliminary Report; 10/10/2024 - Final Report |
| Platform | Arbitrum |
| Language | Solidity |
| Tags | Factory, Token Sales. |
| Methodology | https://hackenio.cc/sc_methodology→ |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Alien.fun
- Audited By
- David Camps Novi
- Approved By
- Grzegorz Trawinski
- Website
- https://www.alien.fun→
- Changelog
- 27/09/2024 - Preliminary Report; 10/10/2024 - Final Report
- Platform
- Arbitrum
- Language
- Solidity
- Tags
- Factory, Token Sales.
- Methodology
- https://hackenio.cc/sc_methodology→
Review Scope | |
|---|---|
| Repository | https://github.com/AlienDotFun/Alien-Contracts→ |
| Commit | 3a5c3b9 |
Review Scope
- Commit
- 3a5c3b9
Audit Summary
The system users should acknowledge all the risks summed up in the risks section of the report
Documentation quality
Functional requirements is partially missed.
General business proposition is provided.
Contracts description and requirements are not provided.
Technical description is not provided.
Code quality
The development environment is not configured.
NatSpec is not provided.
Test coverage
Code coverage of the project is 0% (branch coverage.
Tests cannot be run due to the misconfiguration of the codebase.
System Overview
Alien.fun is a decentralized platform built on blockchain technology that makes it easy to create, collect, and trade vanity tokens or meme coins entirely peer-to-peer (P2P). It consists of the following contracts:
AlienFunToken - Custom ERC20 token contract used as the standard of deployed tokens.
AlienFunBondingCurve - Defines the token buyout or sale of deployed tokens.
AlienFunTokenFactory - Allows a user to deploy an ERC20 token, based on the former two standard contracts.
Privileged roles
Owner - The system owner can
Update the different control parameters: fee receiver, fee percentage, minimum ETH buy amount.
Fund the token creator.
Withdraw native and ERC20 tokens from the AlienFunBondingCurve contract.
Potential Risks
The project uses Solidity version 0.8.20 or higher, which includes the introduction of the PUSH0 (0x5f) opcode. This opcode is currently supported on the Ethereum mainnet but may not be universally supported across other blockchain networks. Consequently, deploying the contract on chains other than the Ethereum mainnet, such as certain Layer 2 (L2) chains or alternative networks, might lead to compatibility issues or execution errors due to the lack of support for the PUSH0 opcode. In scenarios where deployment on various chains is anticipated, selecting an appropriate Ethereum Virtual Machine (EVM) version that is widely supported across these networks is crucial to avoid potential operational disruptions or deployment failures. However, the development team specified that the project will be only deployed on Arbitrum. Hence this would only be problematic in case of new deployments.
The contract AlienFunBondingCurve includes the functions emergencyWithdraw() and emergencyETHWithdraw(), which allow the system owner to retrieve any amount of tokens from the contract at will, without any restrictions.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2024-6344 | Precision Loss in ETH Amount Calculation in sellTokens Function | fixed | Medium | |
| F-2024-6333 | Users can Lose Funds if Contract Balance is Insufficient | accepted | Medium | |
| F-2024-6336 | Unchecked Slippage Parameters May Lead to Loss of Funds | fixed | Low | |
| F-2024-6335 | Accounting Mismatch due to Missing Checks in Token Withdraw | accepted | Low | |
| F-2024-6332 | Requirement Violation due to Imprecise Check | fixed | Low | |
| F-2024-6330 | ERC20 Tokens can Be Transferred for Free | fixed | Low | |
| F-2024-6339 | Division by Zero in Token Price Calculation | accepted | Observation | |
| F-2024-6334 | Best Practice Violation: Arbitrary Variable Naming | accepted | Observation | |
| F-2024-6329 | Unoptimized Access Control | accepted | Observation | |
| F-2024-6328 | Missing Events for Key Value Updates | accepted | Observation |
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/AlienDotFun/Alien-Contracts→ |
| Commit | 3a5c3b9 |
| Whitepaper | - |
| Requirements | https://docs.alien.fun→ |
| Technical Requirements | - |
Scope Details
- Commit
- 3a5c3b9
- Whitepaper
- -
- Requirements
- https://docs.alien.fun→
- Technical Requirements
- -