Staking Farm - Aurora


Prepared by:

Halborn Logo

HALBORN

Last Updated 04/26/2024

Date of Engagement: February 9th, 2022 - March 25th, 2022

Summary

0% of all REPORTED Findings have been addressed

All findings

11

Critical

0

High

0

Medium

0

Low

0

Informational

11


1. INTRODUCTION

Aurora engaged Halborn to conduct a security assessment on the staking farm NEAR smart contracts utilized by them, beginning on February 9th, 2022 and ending March 25th, 2022. Aurora provides Ethereum compatibility, NEAR Protocol scalability, and industry-first user experience through affordable transactions.

Though this security audit's outcome is satisfactory, only the most essential aspects were tested and verified to achieve objectives and deliverables set in the scope due to time and resource constraints. It is essential to note the use of the best practices for secure development.

2. AUDIT SUMMARY

The team at Halborn was provided 6 weeks for the engagement and assigned two full-time security engineers to audit the security of the assets in scope. The engineers are blockchain and smart contract security experts with advanced penetration testing, smart-contract hacking, and deep knowledge of multiple blockchain protocols.

The purpose of this audit is to achieve the following:

    • Identify potential security issues within the NEAR smart contracts.

In summary, Halborn identified few security risks that were mostly addressed by the Aurora team.

3. TEST APPROACH & METHODOLOGY

Halborn performed a combination of manual view of the code and automated security testing to balance efficiency, timeliness, practicality, and accuracy in regard to the scope of the smart contract audit. While manual testing is recommended to uncover flaws in logic, process, and implementation; automated testing techniques help enhance coverage of smart contracts and can quickly identify items that do not follow security best practices. The following phases and associated tools were used throughout the term of the audit:

    • Research into architecture, purpose, and use of the platform.

    • Manual code read and walkthrough.

    • Manual Assessment of use and safety for the critical Rust variables and functions in scope to identify any arithmetic related vulnerability classes.

    • Fuzz testing. (cargo fuzz, honggfuzz)

    • Checking the unsafe code usage. (cargo-geiger)

    • Scanning of Rust files for vulnerabilities.(cargo audit)

    • Deployment to devnet through near-cli

5. RISK METHODOLOGY

Vulnerabilities or issues observed by Halborn are ranked based on the risk assessment methodology by measuring the LIKELIHOOD of a security incident and the IMPACT should an incident occur. This framework works for communicating the characteristics and impacts of technology vulnerabilities. The quantitative model ensures repeatable and accurate measurement while enabling users to see the underlying vulnerability characteristics that were used to generate the Risk scores. For every vulnerability, a risk level will be calculated on a scale of 5 to 1 with 5 being the highest likelihood or impact.
RISK SCALE - LIKELIHOOD
  • 5 - Almost certain an incident will occur.
  • 4 - High probability of an incident occurring.
  • 3 - Potential of a security incident in the long term.
  • 2 - Low probability of an incident occurring.
  • 1 - Very unlikely issue will cause an incident.
RISK SCALE - IMPACT
  • 5 - May cause devastating and unrecoverable impact or loss.
  • 4 - May cause a significant level of impact or loss.
  • 3 - May cause a partial impact or loss to many.
  • 2 - May cause temporary impact or loss.
  • 1 - May cause minimal or un-noticeable impact.
The risk level is then calculated using a sum of these two values, creating a value of 10 to 1 with 10 being the highest level of security risk.
Critical
High
Medium
Low
Informational
  • 10 - CRITICAL
  • 9 - 8 - HIGH
  • 7 - 6 - MEDIUM
  • 5 - 4 - LOW
  • 3 - 1 - VERY LOW AND INFORMATIONAL
Our penetration tests use the industry standard Common Vulnerability Scoring System (CVSS) to calculate the severity of our findings.

6. SCOPE

Out-of-Scope: New features/implementations after the remediation commit IDs.

7. Assessment Summary & Findings Overview

Critical

0

High

0

Medium

0

Low

0

Informational

11

Security analysisRisk levelRemediation Date
HAL01 - PUBLICLY CALLABLE FUNCTIONS LEADING TO OUT-OF-CONTRACT FUNDS BURNInformational-
HAL02 - IMPROPER ROLE-BASED ACCESS CONTROL POLICYInformational-
HAL03 - MULTIPLE STAKING ACTIONS CAN BE PERFORMED WHILE CONTRACT IS PAUSEDInformational-
HAL04 - LACK OF VALIDATION OF BURN FRACTIONInformational-
HAL05 - VALUE CONVERSION TO SMALLER SIZES MAY RESULT IN OVERFLOWSInformational-
HAL06 - DELEGATOR AND PREDECESSOR CAN BE THE SAMEInformational-
HAL07 - USE OF VULNERABLE CRATESInformational-
HAL08 - DEPOSIT ATTACHED IS NOT ASSERTEDInformational-
HAL09 - REDUNDANT ASSERTIONInformational-
HAL10 - ASSERTION SHOULD BE REPLACED BY A MACROInformational-
HAL11 - DEFAULT IMPLEMENTATION SHOULD BE REPLACED BY A MACROInformational-

8. Findings & Tech Details

8.1 HAL01 - PUBLICLY CALLABLE FUNCTIONS LEADING TO OUT-OF-CONTRACT FUNDS BURN

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.2 HAL02 - IMPROPER ROLE-BASED ACCESS CONTROL POLICY

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.3 HAL03 - MULTIPLE STAKING ACTIONS CAN BE PERFORMED WHILE CONTRACT IS PAUSED

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.4 HAL04 - LACK OF VALIDATION OF BURN FRACTION

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.5 HAL05 - VALUE CONVERSION TO SMALLER SIZES MAY RESULT IN OVERFLOWS

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.6 HAL06 - DELEGATOR AND PREDECESSOR CAN BE THE SAME

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.7 HAL07 - USE OF VULNERABLE CRATES

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.8 HAL08 - DEPOSIT ATTACHED IS NOT ASSERTED

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.9 HAL09 - REDUNDANT ASSERTION

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.10 HAL10 - ASSERTION SHOULD BE REPLACED BY A MACRO

//

Informational

Description
Finding description placeholder
Score
(0.0)

8.11 HAL11 - DEFAULT IMPLEMENTATION SHOULD BE REPLACED BY A MACRO

//

Informational

Description
Finding description placeholder
Score
(0.0)

9. Automated Testing

AUTOMATED ANALYSIS

Description

Halborn used automated security scanners to assist with detection of well-known security issues and vulnerabilities. Among the tools used was cargo audit, a security scanner for vulnerabilities reported to the RustSec Advisory Database. All vulnerabilities published in https://crates.io are stored in a repository named The RustSec Advisory Database. cargo audit is a human-readable version of the advisory database which performs a scanning on Cargo.lock. Security Detections are only in scope. All vulnerabilities shown here were already disclosed in the above report. However, to better assist the developers maintaining this code, the auditors are including the output with the dependencies tree, and this is included in the cargo audit output to better know the dependencies affected by unmaintained and vulnerable crates.

Results

\begin{center} \begin{tabular}{|l|p{2cm}|p{9cm}|} \hline \textbf{ID} & \textbf{package} & \textbf{Short Description} \ \hline \href{https://rustsec.org/advisories/RUSTSEC-2020-0159}{RUSTSEC-2020-0159} & chrono & Potential segfault in localtime\textunderscore r invocations \ \hline \href{https://rustsec.org/advisories/RUSTSEC-2021-0067}{RUSTSEC-2021-0067} & cranelift-codegen & Memory access due to code generation flaw in Cranelift module\ \hline \href{https://rustsec.org/advisories/RUSTSEC-2021-0013}{RUSTSEC-2021-0013} & raw-cpuid & Soundness issues in raw-cpuid \ \hline \href{https://rustsec.org/advisories/RUSTSEC-2021-0089}{RUSTSEC-2021-0089} & raw-cpuid & Optional Deserialize implementations lacking validation \ \hline \href{https://rustsec.org/advisories/RUSTSEC-2022-0013}{RUSTSEC-2022-0013} & regex & Regexes with large repetitions on empty sub-expressions take a very long time to parse \ \hline \href{https://rustsec.org/advisories/RUSTSEC-2020-0071}{RUSTSEC-2020-0071} & time & Potential segfault in the time crate \ \hline \href{https://rustsec.org/advisories/RUSTSEC-2021-0110}{RUSTSEC-2021-0110} & wasmtime & Multiple Vulnerabilities in Wasmtime \ \hline \end{tabular} \end{center}

Halborn strongly recommends conducting a follow-up assessment of the project either within six months or immediately following any material changes to the codebase, whichever comes first. This approach is crucial for maintaining the project’s integrity and addressing potential vulnerabilities introduced by code modifications.

© Halborn 2025. All rights reserved.