Description:
The runLiquidation()
function contains sub-function calls that iterate through the pendingStakes
, holders
, and _asset
arrays. As the protocol grows, these arrays become longer, resulting in increased gas consumption when calling the function. A malicious attacker could intentionally lengthen these arrays, making the distributeAsset()
function unresponsive and preventing the liquidation of a vault.
Impact:
The inability to liquidate vaults as intended may lead to the undercollateralization of the EUROs token.
Proof of Concept:
John (Attacker) anticipates vault liquidation.
He calls increasePosition()
repeatedly to lengthen the pending stake array.
When LiquidationPoolManager::runLiquidation
is executed, it fails with an "out of gas" error.
This prevents John's vault from being liquidated.
Proof of Code:
The provided test suite demonstrates the vulnerability's validity and severity.
Due to the file size required to run this PoC, the suite is hosted on Github.
To run the PoC, clone the repository.
Minor changes, such as modifying function visibility, were made to enable successful test runs.
All changes and additional files made to the original code are documented in the README and the respective files where the changes are made.
Requirements:
Install Foundry.
Clone the project codebase into your local workspace.
Run the following commands to install dependencies:
Run the following command to execute the PoC:
Tools Used:
Manual review
Foundry
Recommended Mitigation Steps:
To address this issue, a thorough examination of the contract architecture is required. Consider exploring gas-efficient alternatives, such as using mappings instead of arrays.
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.