initiateLiquidation
function allows anyone to initiate the liquidation process if a user's health factor is below threshold, but to calculate collateral value it iterate over an unbounded array user.nftTokenIds
which can be exploited and make it run out of gas.
the process of initiating liquidation start by checking health factor and to do that contract iterate over user.nftTokenIds
to gets the total collateral value of a user
Due to the limit of gas imposed in every block, the contract can run out of gas.
As we can see depositNFT
allows users to NFT tokens with an unbounded amount. Specifically, the function does not impose a hard cap on the number of elements.
As a consequence, an user.nftTokenIds
array with a large number of elements can lead to service disruption. This is due to the fact that the getUserCollateralValue
function iterate over the unbounded user.nftTokenIds
array, which depending on the amount of elements, can lead to unexpected out-of-gas errors.
Even if the issue remains unexploited by attackers, normal users may inadvertently cause NFTs to become stuck in the contract. This occurs when users deposit a large number of tokens and later attempt to withdraw them, as the withdrawNFT
function iterates over the entire user.nftTokenIds
array, potentially exceeding gas limits and halting the transaction.
Manual audit
the best way to prevent dos attacker is to impose a hard cap on the number of elements.
LightChaser L-36 and M-02 covers it.
LightChaser L-36 and M-02 covers it.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.