Q1 2025 Web3 Security ReportAccess control failures led to $1.63 billion in losses
Discover report insights
  • Hacken
  • Audits
  • paribus
  • [SCA] Paribus / Lending / Jan2023
Paribus logo

Paribus

Audit name:

[SCA] Paribus / Lending / Jan2023

Date:

Mar 11, 2023

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 Paribus team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.

Paribus is a cross-chain borrowing and lending protocol for NFTs, liquidity positions, and synthetic assets, powered by the Cardano blockchain.

titlecontent
PlatformEVM
LanguageSolidity
TagsLending Platform
Timeline22/01/2023 - 13/03/2023
Methodologyhttps://hackenio.cc/sc_methodology

    Review Scope

    Repositoryhttps://github.com/Paribus/paribus-protocol-contracts
    Commit294e42958a502f4a3600629035ad055728df6b5a

    Audit Summary

    Total8.7/10
    Security Score

    10/10

    Test Coverage

    71.7%

    Code Quality Score

    9/10

    Documentation Quality Score

    10/10

    20Total Findings
    13Resolved
    0Accepted
    6Mitigated

    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

    NameSmart Contract Code Review and Security Analysis Report for Paribus
    Audited ByHacken
    Websitehttps://paribus.io/
    Changelog29/01/2023 - Initial Review
    22/02/2023 - Second Review
    13/03/2023 - Third Review
    • Document

      Name
      Smart Contract Code Review and Security Analysis Report for Paribus
      Audited By
      Hacken
      Changelog
      29/01/2023 - Initial Review
      22/02/2023 - Second Review
      13/03/2023 - Third Review

    System Overview

    The Paribus Protocol is an Ethereum smart contract for supplying or borrowing assets. Through the pToken contracts, accounts on the blockchain supply capital (Ether or ERC-20 tokens) to receive pTokens or borrow assets from the protocol (holding other assets as collateral).

    The Paribus pToken contracts track these balances and algorithmically set interest rates for borrowers. The core contracts of the system are the following;

    • PToken, PErc20 and PEther - The Paribus pTokens, which are self-contained borrowing and lending contracts. PToken contains the core logic and PErc20 and PEther add public interfaces for Erc20 tokens and Ether, respectively. Each PToken is assigned an interest rate and risk model (see InterestRateModel and Comptroller sections), and allows accounts to *mint* (supply capital), *redeem* (withdraw capital), *borrow* and *repay a borrow*. Each PToken is an ERC-20 compliant token where balances represent ownership of the market.

    • Comptroller - The risk model contract, which validates permissible user actions and disallows actions if they do not fit certain risk parameters. For instance, the Comptroller enforces that each borrowing user must maintain a sufficient collateral balance across all pTokens.

    • Paribus (PBX) - The Paribus Governance Token (PBX).

    • InterestRateModel - Contracts which define interest rate models. These models algorithmically determine interest rates based on the current utilization of a given market (that is, how much of the supplied assets are liquid versus borrowed).

    • Careful Math - Library for safe math operations.

    • ErrorReporter - Library for tracking error codes and failure conditions.

    • Exponential - Library for handling fixed-point decimal numbers.

    • SafeToken - Library for safely handling Erc20 interactions.

    • WhitePaperInterestRateModel - Initial interest rate model, as defined in the Whitepaper. This contract accepts a base rate and slope parameter in its constructor.

    The architecture of the project is described as the following in the litepaper:

    Loading...

    Privileged roles

    Roles defined in the system are the following:

    • Lenders - The lender is key in any DeFi platform. Most of the time these users are known as “HODLers” within the cryptocurrency space. They have no plans to outright sell their crypto assets. Paribus will be an additional outlet for this user group to earn a passive income while their underlying assets appreciate in value over time. Lenders can be thought of as liquidity providers within the ecosystem and earn interest in return for doing so. The platform will provide Deposit APR(%) based on factors such as utilization rate. Lenders can at a rough level estimate their earnings based on the Deposit APR(%) for a given asset.

    • Borrowers - Paribus will operate strictly as a collateralized loan platform. Meaning any borrower must deposit asset(s) in order to borrow against. As a result borrowers are indirectly also liquidity providers to assure the platform is sustainable and self-sufficient. Every borrower is subject to paying a small one-time fixed platform fee as well as the interest accrued over the period of the loan. The fee mechanism is detailed in the latter section of this paper.

    • Admin - Admins can change proxies implementations to a deployed contract address and change the contract behavior by delegating calls to the new implementation address.

    • Pause Guardian - Can pause certain actions as a safety mechanism. Actions which allow users to remove their own assets cannot be paused.

    • Borrow Cap Guardian - Can set borrow caps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.

    Recommendations

    • The system relies on the security of the Admin's private keys, which can impact the execution flow and security of the funds. We recommend this account to be at least ⅗ multi-sig.

    Executive Summary

    Documentation quality

    The total Documentation quality score is 10 out of 10.

    • Functional requirements are available and detailed.

    • The differences between Paribus and Compound are visible in the documents provided exclusively for Paribus.

    Code quality

    The total Code quality score is 9 out of 10.

    • An outdated compiler version is used.

    Test coverage

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

    • Deployment and basic user interactions are covered with tests.

    • Not all negative cases/exceptions/reverts are tested.

    • Interactions with several users are not tested thoroughly.

    Security score

    Upon auditing, the code was found to contain 0 critical, 4 high, 4 medium, and 12 low severity issues. Out of these, 13 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 8.7. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.

    Risks

    The project uses outdated Solidity pragma versions. Using an outdated compiler version can be problematic, especially if there are publicly disclosed bugs and issues that affect the current compiler version.

    The project uses proxies and is upgradeable which makes it centralized. The upgradeable nature of the contracts puts the implementation at risk in case of logic upgrade. Contracts can have their implementation changed without sufficient time for users to react to bad changes (i.e, the contracts are not using any sort of an implementation changing proposals mechanism that requires a certain delay to be implemented after a request by an admin).

    Findings

    Code
    Title
    Status
    Severity
    F-2023-0565Undocumented Behavior
    fixed

    High
    F-2023-0564Requirements Violation
    mitigated

    High
    F-2023-0563Non-Finalized Code
    fixed

    High
    F-2023-0562Non-Finalized Code
    fixed

    High
    F-2023-0569Unscalable Functionality - Shadowing State Variable
    fixed

    Medium
    F-2023-0568Contradiction - Missing Validation
    fixed

    Medium
    F-2023-0567Unscalable Functionality - Shadowing State Variable
    fixed

    Medium
    F-2023-0566Best Practice Violation - Usage of Assert
    fixed

    Medium
    F-2023-0581Outdated Compiler Version
    unfixed

    Low
    F-2023-0580No Messages in Require Conditions
    fixed

    Low
    1-10 of 20 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/Paribus/paribus-protocol-contracts
    Commit294e42958a502f4a3600629035ad055728df6b5a
    WhitepaperProvided
    RequirementsProvided
    Technical RequirementsProvided

    Contracts in Scope

    contracts
    Comptroller
    ComptrollerCommonImpl.sol - contracts/Comptroller/ComptrollerCommonImpl.sol
    ComptrollerInterfaces.sol - contracts/Comptroller/ComptrollerInterfaces.sol
    ComptrollerPart1.sol - contracts/Comptroller/ComptrollerPart1.sol
    ComptrollerPart2.sol - contracts/Comptroller/ComptrollerPart2.sol
    ComptrollerStorage.sol - contracts/Comptroller/ComptrollerStorage.sol
    Unitroller.sol - contracts/Comptroller/Unitroller.sol
    ErrorReporter.sol - contracts/ErrorReporter.sol
    InterestRateModels
    BaseJumpRateModelV2.sol - contracts/InterestRateModels/BaseJumpRateModelV2.sol
    InterestRateModelInterface.sol - contracts/InterestRateModels/InterestRateModelInterface.sol
    JumpRateModelV2.sol - contracts/InterestRateModels/JumpRateModelV2.sol
    WhitePaperInterestRateModel.sol - contracts/InterestRateModels/WhitePaperInterestRateModel.sol
    JumpRateModel.sol - contracts/InterestRateModels/JumpRateModel.sol
    LegacyInterestRateModel.sol - contracts/InterestRateModels/LegacyInterestRateModel.sol
    LegacyJumpRateModelV2.sol - contracts/InterestRateModels/LegacyJumpRateModelV2.sol
    Interfaces
    Api3Interfaces.sol - contracts/Interfaces/Api3Interfaces.sol
    EIP20Interface.sol - contracts/Interfaces/EIP20Interface.sol
    EIP20NonStandardInterface.sol - contracts/Interfaces/EIP20NonStandardInterface.sol
    AaveInterfaces.sol - contracts/Interfaces/AaveInterfaces.sol

    Disclaimer