The chainlink price feed data is not validated at all in the distributeAssets
function of the LiquidationPool
contract, which can lead to a loss of user funds.
The distributionAssets
function is used to distribute collateral tokens from liquidations and reward them to the stakers, which buy them for EURO tokens on a discount. The function uses the chainlink price feed to calculate the amount of collateral tokens to distribute, depending on the current price of the collateral tokens. There are two different chainlink requests inside the function in neither implements the recommended security checks from chainlink.
Therefore, a stale price could be used for calculation, leading to a loss of funds as users could pay more EURO tokens for the collateral tokens instead of getting a discount.
Here we can see the distributeAssets
function and that no security checks are implemented:
Loss of user funds.
The following best practices recommended by chainlink should be implemented to reduce the chance of working with stale prices:
Check the output against 0
Check the output to be in a min max range
Read the updatedAt parameter from the calls to latestRoundData() and check it against 0
Read the updatedAt parameter from the calls to latestRoundData() and check that it isn't older than a given maximum depending on the price feed
Check if the L2 Sequencer is down on chains like Arbitrum
Implement a way to update the eurUsd address as it could potentially be possible that the chainlink oracle will not work in the future
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.