#37940 [SC-High] freezing of user funds when reward accumulated or added

#37940 [SC-High] Freezing of user funds When Reward accumulated or added

Submitted on Dec 19th 2024 at 09:51:34 UTC by @Blockian for Audit Comp | Folks: Liquid Staking

  • Report ID: #37940

  • Report Type: Smart Contract

  • Report severity: High

  • Target: https://github.com/Folks-Finance/algo-liquid-staking-contracts/blob/8bd890fde7981335e9b042a99db432e327681e1a/contracts/xalgo/consensus_v2.py

  • Impacts:

    • Permanent freezing of funds

Description

Folks Finance Liquid Staking Bug Report

Freezing of user funds

Description

When rewards are accumulated, the burn function will get frozen.

This allows a malicious actor to cause the burn function to revert, locking user funds.

Root Cause

The issue lies in how the burn function calculates the amount of ALGO to be returned to the user. The logic follows these steps:

The issue arises as follows:

  1. Rewards accumulation causes the algo_balance (total amount of ALGO) to increase.

  2. However, the get_x_algo_circulating_supply remains constant.

  3. When calculating algo_to_send, the proportion becomes skewed, potentially resulting in algo_to_send exceeding the value of total_active_stake_key.

This discrepancy triggers an underflow during the calculation:

As a result, the transaction reverts, preventing the burn function from completing successfully.

Impact

This vulnerability effectively freezes user funds within the protocol because the burn function becomes unusable. The issue can be exploited in the following scenarios:

Malicious Interaction:

  • A malicious actor deliberately manipulates the proposer’s account to trigger the underflow, freezing the burn functionality.

Innocent Interaction:

  • A proposer simply accumulates rewards over time, unintentionally leading to the same issue.

Proof of Concept

POC

Run this test file, the IMMUNEFI POC test is the main test to watch

Last updated

Was this helpful?