The issue is in the LiquidationPool.distributeFees() function, where there's a risk of reentrancy attacks due to the order of operations in the distributeFees function.
The LiquidationPool.distributeFees() function updates state variables after interacting with external contracts, making it vulnerable to reentrancy attacks. An attacker could exploit this by repeatedly calling the function before state variables are updated.
This vulnerability may allow unexpected behavior, as an attacker could manipulate the contract's state during the execution of decreasePosition.
Slither
Reorder Operations:
Change the order of operations in distributeFees to update state variables before making external calls, reducing the risk of reentrancy attacks.
Use Checks-Effects-Interactions Pattern:
Follow a pattern where checks and state variable updates come before interactions with external contracts to minimize reentrancy risks.
By making these changes, the contract can be more secure against reentrancy attacks.
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.