The withdrawFees()
function should safely transfer accumulated protocol fees to the owner-specified address and reset the fee counter atomically to prevent double-withdrawal or reentrancy attacks.
The function violates the Checks-Effects-Interactions (CEI) pattern by making an external call (safeTransfer
) before resetting the totalFees
state variable, creating a reentrancy vulnerability that allows malicious recipient contracts to drain all protocol fees multiple times.
Likelihood:
Owner controls the recipient address (_to
parameter)
If owner uses a contract address as recipient (multisig, treasury contract, etc.)
Malicious or compromised recipient contract could exploit the reentrancy
Higher likelihood than other CEI violations since owner might legitimately use contract recipients
Impact:
Complete drainage of all accumulated protocol fees
Malicious recipient can re-enter before totalFees = 0
executes
Each reentrant call withdraws the full totalFees
amount again
Could result in total loss of protocol revenue
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.