Q2 2026 Security & Compliance Report67 incidents, $764M in losses, 88% from operational failures.
Get the report →

Audit name:

[SCA] XPass | Token | Oct2024

Date:

Oct 29, 2024

Table of Content

→Introduction
→Audit Summary
→System Overview
→Potential Risks
→Findings
→Appendix 1. Definitions
→Appendix 2. Scope
→Appendix 3. Additional Valuables
→Disclaimer

Want a comprehensive audit report like this?

Introduction

We express our gratitude to the X-Pass team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.

XPass is an ERC-20 token project with a locking mechanism.

Document

NameSmart Contract Code Review and Security Analysis Report for X-Pass
Audited ByOlesia Bilenka
Approved ByPrzemyslaw Swiatowiec
Websitehttps://x-pass.io/→
Changelog24/10/2024 - Preliminary Report
29/10/2024 - Final Report
PlatformEthereum Mainnet
LanguageSolidity
TagsFungible Token, Centralization, ERC-20
Methodologyhttps://hackenio.cc/sc_methodology→
  • Document

    Name
    Smart Contract Code Review and Security Analysis Report for X-Pass
    Audited By
    Olesia Bilenka
    Approved By
    Przemyslaw Swiatowiec
    Changelog
    24/10/2024 - Preliminary Report
    29/10/2024 - Final Report
    Platform
    Ethereum Mainnet
    Language
    Solidity
    Tags
    Fungible Token, Centralization, ERC-20

Audit Summary

5Total Findings
1Resolved
3Accepted
1Mitigated

The system users should acknowledge all the risks summed up in the risks section of the report

Documentation quality

  • Functional requirements are provided.

  • Technical description is provided.

Code quality

  • The code duplicates commonly known contracts instead of reusing them.

  • The development environment is configured.

Test coverage

Code coverage of the project is 60.29% (branch coverage).

  • Tests are provided for key functionality.

  • The coverage for negative cases and allowance is missed.

System Overview

XPass is an ERC-20 token project with a locking mechanism.

BasicToken is a contract that provides basic ERC-20 functionalities, including managing token balances, transferring tokens between addresses, and retrieving the total supply of tokens. It emits events when transfers are executed.

Ownable is a contract that manages ownership of the token. It defines ownership transfer and allows functions to be restricted to the owner via the onlyOwner modifier.

BurnableToken extends the BasicToken contract by introducing the ability to burn tokens, reducing the total supply. It allows users to burn their own tokens, and it emits events when tokens are burned.

StandardToken extends ERC-20 functionality by adding allowances. It allows approved spenders to transfer tokens on behalf of an account using transferFrom and supports increasing or decreasing allowances.

XPASSToken is the main contract, implementing the full ERC-20 token standard with additional features like a locking mechanism and transfer restrictions. The owner can enable or disable transfers globally, and accounts can be locked, preventing the transfer of locked tokens. This contract also allows the owner to burn tokens when transfers are enabled and change the admin address.

Privileged roles

  • The owner of the XPASSToken contract can enable or disable token transfers globally. The owner can also lock or unlock any user's tokens by specifying the amount to be locked. Additionally, the owner can change the admin address.

  • The admin of the XPASSToken contract has the ability to perform token transfers even when transfers are globally disabled.

Potential Risks

Fixed Total Supply Post-Deployment: The token’s total supply is determined at deployment and cannot be verified beforehand, potentially limiting the project’s adaptability and economic model flexibility.

Centralized Minting to a Single Address: The project concentrates minting tokens in a single address, raising the risk of fund mismanagement or theft, especially if key storage security is compromised.

Owner's Unrestricted State Modification: The absence of restrictions on state variable modifications by the owner leads to arbitrary changes, affecting contract integrity and user trust, especially during critical operations like minting phases.

Absence of Time-lock Mechanisms for Critical Operations: Without time-locks on critical operations, there is no buffer to review or revert potentially harmful actions, increasing the risk of rapid exploitation and irreversible changes.

Centralization Risk in XPASSToken Leading to Token Locks: Within the XPASSToken contract, there is a function disableTransfer, which allows the owner to disable all token transfers. Additionally, the function lockAccount gives the owner the ability to lock any amount of tokens belonging to any user.

Findings

F-2024-6726Centralization Risk in XPASSToken Leading to Token Locks
Status
fixed
Severity

Medium
F-2024-6706Floating Pragma
Status
mitigated
Severity

Observation
F-2024-6705Unoptimized Storage Access for Total Supply
Status
accepted
Severity

Observation
F-2024-6728Potential Underflow in the onlyAllowedAmount Modifier
Status
accepted
Severity

Observation
F-2024-6727Redundant Comparisons to Boolean Values
Status
accepted
Severity

Observation
Code
―
Title
Status
Severity
F-2024-6726Centralization Risk in XPASSToken Leading to Token Locks
fixed

Medium
F-2024-6706Floating Pragma
mitigated

Observation
F-2024-6705Unoptimized Storage Access for Total Supply
accepted

Observation
F-2024-6728Potential Underflow in the onlyAllowedAmount Modifier
accepted

Observation
F-2024-6727Redundant Comparisons to Boolean Values
accepted

Observation
1-5 of 5 findings

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:

Assets in Scope

XPassToken.sol - XPassToken.sol

Appendix 3. Additional Valuables

Verification of System Invariants

During the audit of XPass, Hacken followed its methodology by performing fuzz-testing on the project's main functions. Foundry, a tool used for fuzz-testing, was employed to check how the protocol behaves under various inputs. Due to the complex and dynamic interactions within the protocol, unexpected edge cases might arise. Therefore, it was important to use fuzz-testing to ensure that several system invariants hold true in all situations.

Fuzz-testing allows the input of many random data points into the system, helping to identify issues that regular testing might miss. A specific Echidna fuzzing suite was prepared for this task, and throughout the assessment, 17 invariants were tested over 100k runs. This thorough testing ensured that the system works correctly even with unexpected or unusual inputs.

Invariant

Test Result

Run Count

BasicToken::totalSupply should always return the correct total supply of tokens.Passed100k+
BasicToken::balanceOf should always return the correct balance for each token holder.Passed100k+
BasicToken::transfer should always revert if the recipient address is address(0) or if the amount exceeds the sender's balance.Failed100k+
BasicToken::transfer should always correctly update the sender's and recipient's balances after the transfer.Passed100k+
StandardToken::transferFrom should always check if the spender has sufficient allowance for the transfer.Passed100k+
StandardToken::transferFrom should always correctly update the sender's and recipient's balances after the transfer and reduce the allowed amount for the spender.Passed100k+
StandardToken::approve should always successfully set an allowance for a spender to a verified amount.Passed100k+
StandardToken::increaseAllowance should always successfully increase the allowed amount for a spender.Passed100k+
StandardToken::decreaseAllowance should decrease and always check that the allowance is not reduced below zero.Passed100k+
XPASSToken::transfer should revert if transferEnabled is false and msg.sender is not adminAddr.Passed100k+
XPASSToken::transfer should revert if the recipient address is address(0), address(this), owner, or adminAddr.Passed100k+
XPASSToken::transferFrom and transfer should only succeed if transferEnabled is true or msg.sender is adminAddr.Passed100k+
XPASSToken::burn should revert if transferEnabled is false.Passed100k+
XPASSToken::burn should succeed only when called by owner and when transferEnabled is true.Passed100k+
XPASSToken::lockAccount should always revert if the account address is address(0), address(this), owner, or adminAddr.Passed100k+
XPASSToken::unlockAccount should always reset the locked balance to zero for the specified account.Passed100k+
XPASSToken::changeAdminAddr should set new admin address.Passed100k+
  • Invariant

    BasicToken::totalSupply should always return the correct total supply of tokens.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    BasicToken::balanceOf should always return the correct balance for each token holder.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    BasicToken::transfer should always revert if the recipient address is address(0) or if the amount exceeds the sender's balance.

    Test Result

    Failed

    Run Count

    100k+

    Invariant

    BasicToken::transfer should always correctly update the sender's and recipient's balances after the transfer.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    StandardToken::transferFrom should always check if the spender has sufficient allowance for the transfer.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    StandardToken::transferFrom should always correctly update the sender's and recipient's balances after the transfer and reduce the allowed amount for the spender.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    StandardToken::approve should always successfully set an allowance for a spender to a verified amount.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    StandardToken::increaseAllowance should always successfully increase the allowed amount for a spender.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    StandardToken::decreaseAllowance should decrease and always check that the allowance is not reduced below zero.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    XPASSToken::transfer should revert if transferEnabled is false and msg.sender is not adminAddr.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    XPASSToken::transfer should revert if the recipient address is address(0), address(this), owner, or adminAddr.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    XPASSToken::transferFrom and transfer should only succeed if transferEnabled is true or msg.sender is adminAddr.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    XPASSToken::burn should revert if transferEnabled is false.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    XPASSToken::burn should succeed only when called by owner and when transferEnabled is true.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    XPASSToken::lockAccount should always revert if the account address is address(0), address(this), owner, or adminAddr.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    XPASSToken::unlockAccount should always reset the locked balance to zero for the specified account.

    Test Result

    Passed

    Run Count

    100k+

    Invariant

    XPASSToken::changeAdminAddr should set new admin address.

    Test Result

    Passed

    Run Count

    100k+

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.

Disclaimer