Closed sherlock-admin closed 2 years ago
Yes, yes it can. Fees admin is a trusted entity. Yes the separate tracking of fees could solve that but realistically although methods emergencyTransfer and claimFees are not orthogonal, we can probably assume that they are acting as trusted parties. this is not a perfect example of the responsibility separation, that I agree. Still probably would leave this as is for organizational reasons -- admin is a super power user who rarely steps in the scene, so for accidentally transferred funds mb yield distributor would be easier to execute if it comes to that (but its key could be also given to backend to collect fees, while admin key is stashed).
So the issue is that claimFees
can front-run emergencyTransfer
? I think that's a low severity
berndartmueller
medium
The yield distributor can transfer accidentally sent funds
Summary
The yield distributor can repurpose the
claimFees
function to transfer accidentally sent funds to itself.Vulnerability Detail
Both the
ExchangeProxy
andHardenedTopupProxy
contracts have a functionemergencyTransfer
to allow an admin to rescue any ERC20 tokens accidentally sent to the contracts.However, a yield distributor can also transfer those funds via the
claimFees
function. TheclaimFees
function is intended to be used by the yield distributor to claim collected fees. As the contracts do not keep track of the fees collected, the yield distributor is able to claim and transfer any amount of ERC-20 tokens and native tokens, effectively stealing funds.Impact
The yield distributor can transfer any ERC-20 tokens and native tokens accidentally sent to the contracts besides the fees collected.
Code Snippet
ExchangeProxy.sol#L242-L263
HardenedTopupProxy.sol#L248-L273
Tool Used
Manual Review
Recommendation
Consider keeping track of the collected fees and only allow the yield distributor to withdraw the tracked fee token balances.