The code appears to have a potential reentrancy vulnerability in the runLiquidation
function, which could lead to unexpected behavior and security risks.
In the runLiquidation
function, after calling manager.liquidateVault(_tokenId)
, the distributeFees
function is invoked. However, this function interacts with external contracts and transfers tokens, creating a potential reentrancy vulnerability. If any of the external contracts involved in distributeFees
trigger a callback to this contract, the distributeFees
function may be reentered before completing, leading to unexpected and potentially malicious behavior.
If exploited, the reentrancy vulnerability could result in unexpected state changes and potential security risks. It is crucial to address this issue promptly to safeguard the integrity and security of the contract.
Manual Review
Implement reentrancy protection to ensure that the contract state is correctly managed during external calls. One common practice is to use the "Checks-Effects-Interactions" pattern where external calls are made after state changes. Here is a suggestion for updating the runLiquidation
function:
By using a reentrancy guard, you can mitigate the risk of reentrancy attacks during the execution of the distributeFees
and distributeAssets
functions.
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.