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

Audit name:

[SCA] USSD | Oracles | Jan2024

Date:

Mar 6, 2024

Table of Content

→Introduction
→Audit Summary
→Document Information
→System Overview
→Executive Summary
→Risks
→Findings
→Appendix 1. Severity Definitions
→Appendix 2. Scope
→Disclaimer

Want a comprehensive audit report like this?

Introduction

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

USSD is an autonomous stablecoin with crypto collateralization.

titlecontent
PlatformEVM (Ethereum, Arbitrum, BNB Smart Chain, Optimism)
LanguageSolidity
TagsOracle, Staking, Stablecoin
Timeline15/01/2024 - 07/03/2024
Methodologyhttps://hackenio.cc/sc_methodology→

    Review Scope

    Repositoryhttps://github.com/DavidLeeChaum/USSDv2/→
    Commitbf57fe60453768e41fdfb27b683abbffe9a700d6

    Audit Summary

    Total9.3/10
    Security Score

    9/10

    Test Coverage

    N/A

    Code Quality Score

    10/10

    Documentation Quality Score

    10/10

    16Total Findings
    14Resolved
    1Accepted
    1Mitigated

    The system users should acknowledge all the risks summed up in the risks section of the report. Mitigated issues are excluded from the Total Findings count.

    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

    NameSmart Contract Code Review and Security Analysis Report for USSD
    Audited ByMaksym Fedorenko, Roman Tiutiun
    Approved ByPrzemyslaw Swiatowiec
    Websitehttps://www.ussd.ai/→
    Changelog22/01/2024 - Preliminary Report
    22/02/2024 - Second Review
    07/03/2024 - Third Review
    • Document

      Name
      Smart Contract Code Review and Security Analysis Report for USSD
      Audited By
      Maksym Fedorenko, Roman Tiutiun
      Approved By
      Przemyslaw Swiatowiec
      Changelog
      22/01/2024 - Preliminary Report
      22/02/2024 - Second Review
      07/03/2024 - Third Review

    System Overview

    USSD is an autonomous stablecoin with crypto collateralization with the following contracts:

    • USSD  — an autonomous on-chain stablecoin system. The contract uses the ERC20 standard for token implementation and includes additional functionality for minting, redeeming, and managing the stablecoin. It also interacts with external contracts and oracles to determine asset prices and manage collateral.

    • USSDRewards — is an extension of the ERC20 token standard. This contract is designed to distribute rewards through USSDToken tokens to users who hold the USSDRewards token. The rewards are calculated based on the average percentage yield (APY) over time and the total supply of staked tokens.

    • stUSSD — is a staking token, where users can deposit a token (presumably called USSD) and receive stUSSD tokens in return, which may earn rewards over time. The contract includes functionality for depositing, withdrawing, and redeeming tokens, as well as accounting logic to manage the relationship between assets and shares.

    • ICT — is a contract that deals with insurance and rewards, using two types of tokens: WETH (Wrapped Ether) and WBGL (presumably another token). The contract allows users to mint new tokens in exchange for WETH or WBGL and to claim insurance under certain conditions.

    Privileged roles

    • The USSD contract owner has the flexibility to add a staking contract, insurance contract, and configure oracles. Additionally, they can enable WETH and DAI tokens as collateral, but it is important to note that these actions above in this paragraph can be performed only once ever by the admin.

    • The admin role may be transferred from one user to another multiple times.

    Executive Summary

    Documentation quality

    The total Documentation Quality score is 10 out of 10.

    • Functional requirements are provided

    • Technical description is provided.

    Code quality

    The total Code Quality score is 10 out of 10.

    Test coverage

    Code coverage of the project is N/A

    • Code coverage cannot be calculated due to the lack of Truffle framework support by the code coverage tools.

    • While the project includes tests, they do not cover all possible branches. Test coverage is assumed to be 100% due to the inability to measure coverage.

    Security score

    Upon auditing, the code was found to contain 1 critical, 2 high, 4 medium, and 1 low severity issues. The 1 critical, 2 high, and 1 medium severity issues were promptly addressed, fixed, mitigated or accepted as part of the remediation efforts. After the remediation check of the audit process, 1 medium severity issues were accepted by the client, leading to a security score of 9 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.3. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.

    Risks

    The repository includes dependencies beyond the audit scope, introducing potential security risks associated with third-party code such as the solmate library and third-party protocols like Oracles and DEXs. Due to the composability of contracts, these external dependencies pose inherent security risks that are not covered in the audit.

    The stable coin collaterization ratio might fall lower 100% any time due to the collateral tokens price fluctuations.

    If the collateral ratio is below 95%, then the conversion of USSD within the protocol is only possible with a 5% discount. For example with the 0.94 collateral ratio the protocol has only 0.94 cents of collateral to cover one USSD token, but with the discount it would be possible to convert one USSD to only 0.893 USD of collateral (Collateral ratio * (1 - discount) =  0.94 * 0.95 = 0.893)

    Before using the system it is recommended to make sure that the proper Oracles addresses are specified within the next variables:  STABLE_ORACLE, STABLEDAI_ORACLE, WBGL_ORACLE, WBTC_ORACLE, and WETH_ORACLE. The reliability of these Price Oracles themselves poses a risk independent of the USSD admin's behavior.

    Excessive minting of USSD may occur, the risk arises not from the minting process itself, but from staking reward minting. This risk could materialize if collateral value updates are delayed. Collateral value updates occur during USSD token minting against collateral or can be triggered by anyone at any time. The admin must ensure timely updates, or trigger them if necessary.

    Insurance contract may not have enough funds to increase the collaterization ratio sufficiently.

    Findings

    F-2024-0518The Staking Rewards Are Not Minted
    Status
    fixed
    Severity

    Critical
    F-2024-0521Flashloan Attack to Increase The Staking Rewards
    Status
    fixed
    Severity

    High
    F-2024-0519Staking Rewards are Not Separated From Users Balances
    Status
    fixed
    Severity

    High
    F-2024-0970The System Might Mint Redundant Rewards
    Status
    mitigated
    Severity

    Medium
    F-2024-0540Arbitrage Opportunities Can Affect The Price Stability
    Status
    accepted
    Severity

    Medium
    F-2024-0520Insurance Tokens are Transferable Independent From Collateralization Level
    Status
    fixed
    Severity

    Medium
    F-2024-0515Funds Lock On the Insurance Contract
    Status
    fixed
    Severity

    Medium
    F-2024-0497Missing Checks for Zero Address
    Status
    fixed
    Severity

    Low
    F-2024-0539Redundant Code Blocks
    Status
    fixed
    Severity

    Observation
    F-2024-0522Redundancy with Solmate and OpenZeppelin in Safe Transfers and ERC-20 Interactions
    Status
    fixed
    Severity

    Observation
    Code
    ―
    Title
    Status
    Severity
    F-2024-0518The Staking Rewards Are Not Minted
    fixed

    Critical
    F-2024-0521Flashloan Attack to Increase The Staking Rewards
    fixed

    High
    F-2024-0519Staking Rewards are Not Separated From Users Balances
    fixed

    High
    F-2024-0970The System Might Mint Redundant Rewards
    mitigated

    Medium
    F-2024-0540Arbitrage Opportunities Can Affect The Price Stability
    accepted

    Medium
    F-2024-0520Insurance Tokens are Transferable Independent From Collateralization Level
    fixed

    Medium
    F-2024-0515Funds Lock On the Insurance Contract
    fixed

    Medium
    F-2024-0497Missing Checks for Zero Address
    fixed

    Low
    F-2024-0539Redundant Code Blocks
    fixed

    Observation
    F-2024-0522Redundancy with Solmate and OpenZeppelin in Safe Transfers and ERC-20 Interactions
    fixed

    Observation
    1-10 of 16 findings

    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

    Repositoryhttps://github.com/DavidLeeChaum/USSDv2→
    Commitbf57fe60453768e41fdfb27b683abbffe9a700d6
    Whitepaper-
    Requirements-
    Technical RequirementsReadme.md

    Contracts in Scope

    ussdv2
    contracts
    USSDRewards.sol - ussdv2 › contracts › USSDRewards.sol
    USSD.sol - ussdv2 › contracts › USSD.sol
    stUSSD.sol - ussdv2 › contracts › stUSSD.sol
    ICT.sol - ussdv2 › contracts › ICT.sol
    Migrations.sol - ussdv2 › contracts › Migrations.sol
    interfaces
    IStableOracle.sol - ussdv2 › contracts › interfaces › IStableOracle.sol
    IStaticOracle.sol - ussdv2 › contracts › interfaces › IStaticOracle.sol
    IUSSD.sol - ussdv2 › contracts › interfaces › IUSSD.sol
    IUSSDInsurance.sol - ussdv2 › contracts › interfaces › IUSSDInsurance.sol
    oracles
    SimOracle.sol - ussdv2 › contracts › oracles › SimOracle.sol
    StableOracleUSDT.sol - ussdv2 › contracts › oracles › StableOracleUSDT.sol
    StableOracleWBGL.sol - ussdv2 › contracts › oracles › StableOracleWBGL.sol
    StableOracleWBTC.sol - ussdv2 › contracts › oracles › StableOracleWBTC.sol
    StableOracleWETH.sol - ussdv2 › contracts › oracles › StableOracleWETH.sol

    Disclaimer