Skip to content
Business logic Audit finding Advanced

manipulation of the Utilization Rates using the locker.sol function deposit and redeem to Force Liquidations

A user with many NFTs can deposit and redeem them without fees to change the total supply of ERC20 tokens, which alters the utilization rate and interest rates, potentially forcing other protected listings into liquidation. The attacker could then earn keeper rewards and buy liquidated NFTs at a discount.

BugPull Follow with ComposableSecurity, OpaBatyo and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-08-flayer-judging/issues/476

Found by

BugPull, ComposableSecurity, OpaBatyo, jo13

Summary

A user with a significant number of NFTs can manipulate the totalsupply of ERC20 tokens to indirectly push protected listings towards liquidation by influencing the utilizationrate and associated .

Vulnerability Detail

The vulnerability arises from the ability of a user to deposit and redeem any quantities of NFTs,without fees As shown in the locker.sol contract : -the deposit function increase the totalsupply by mint function.

JavaScript
function deposit(address _collection, uint[] calldata _tokenIds, address _recipient) public
    {
     //.....
        ICollectionToken token = _collectionToken[_collection];
        token.mint(_recipient, tokenIdsLength * 1 ether * 10 ** token.denomination());
    //.....
     }

-and decrease the totalsupply using the redeem function.

JavaScript

 function redeem(address _collection, uint[] calldata _tokenIds, address _recipient)  public 
   { 
     //...
 collectionToken_.burnFrom(msg.sender, tokenIdsLength * 1 ether * 10 ** collectionToken_.denomination());
    //..
  }

so a user with a lot of nft could thereby alter the total supply of ERC20 tokens ,This manipulation affects the utilization rate, https://github.com/sherlock-audit/2024-08-flayer/blob/main/flayer/src/contracts/ProtectedListings.sol#L261-L276 which in turn influences interest rates that used directly to calculate calculateCompoundedFactor

JavaScript

 function calculateCompoundedFactor(uint _previousCompoundedFactor, uint _utilizationRate, uint _timePeriod) public view returns (uint compoundedFactor_) {
        uint interestRate = this.calculateProtectedInterest(_utilizationRate);
        uint perSecondRate = (interestRate * 1e18) / (365 * 24 * 60 * 60);
        compoundedFactor_ = _previousCompoundedFactor * 
        (1e18 + (perSecondRate / 1000 * _timePeriod)) / 1e18;
    }

we use this to Calculate the amount of tax that would need to be paid against protected listings. in the function unlockPrice https://github.com/sherlock-audit/2024-08-flayer/blob/main/flayer/src/contracts/ProtectedListings.sol#L607-L617 this function is used to check the the protected listing health in getProtectedListingHealth that used in liquidateProtectedListing An exploitation of the direct relation between the totalsupply and the liquidation is possible by a malicious user who owns half of the NFTs. The user can performs an action that causes the liquidation of the positions of the other participants and receives the KEEPER_REWARD for being a keeper for initiating the liquidation process. In addition, the user can buy up the one that had its NFT liquidated at an auction at a discount price which increases their gain.

Impact

The impact of this vulnerability is that it allows a user to exploit the system to force protected listings into liquidation. This can lead to losses for other users whose listings are liquidated. It undermines the stability and fairness of the protocol by enabling manipulative tactics.

Code Snippet

https://github.com/sherlock-audit/2024-08-flayer/blob/main/flayer/src/contracts/ProtectedListings.sol#L261-L276 https://github.com/sherlock-audit/2024-08-flayer/blob/main/flayer/src/contracts/ProtectedListings.sol#L607-L617

Tool used

Manual Review

Recommendation

use fees in deposit and redeem

The original report as published on Sherlock, by BugPull. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the deposit and redeem functions allow fee-free minting and burning of collection tokens, which lets a large holder manipulate the total supply and thus the utilization rate that determines interest and liquidation thresholds.

Impact

This could force other users' protected listings into liquidation, causing losses for them, while the attacker may earn keeper rewards and buy liquidated NFTs at a discount.

What the attacker needed

Owns a large number of NFTs; no fees on deposit and redeem

The fix

The recommendation is to charge fees on deposit and redeem to prevent costless manipulation of the total supply.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In this system, people lock up NFTs as collateral and borrow tokens against them. The interest rate they pay depends on how many tokens are borrowed compared to the total supply. The report says someone with lots of NFTs can add or remove them without paying fees, which changes the total supply and therefore the interest rate. By making interest rates spike, they can make other people's loans unhealthy and get them liquidated, profiting from the process.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by BugPull

View all

4 more disclosed reports, best first.

More from Flayer

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.