Closed sherlock-admin2 closed 8 months ago
1 comment(s) were left on this issue during the judging contest.
WangAudit commented:
I don't think it prevents greater than should. The plugin is deactivated; thus swaps using the referrals should be reverted cause they cannot be executed 100% correctly. But you can still execute regular swaps; therefore; the issue is not greater than the feature
ZdravkoHr.
medium
Swaps that include referrals cannot be executed when the defi plugin is deactivated
Summary
The protocol pays referrers every time a referred by them account generates a fee. The referral data is included in
DefiSwap
and is used to callincreaseClaimableBy
on the defi plugin. However, the defi plugin can be deactivated. Then all swaps including a referral information will be reverted.Vulnerability Detail
To execute a swap, a wallet tx data will be offered by the Telcoin protocol to the onwer of the wallet. The wallet will sign the message offchain and the data will be used by an address having the
SWAPPER
role to execute the swap by callingAmirX
.When the fee is distributed, the defi plugin is called to increase the allowance of the referrer. However, if the defi plugin is deactivated, the whole tx will revert and any swaps with referrers will not be executed successfully.
This is exactly what is mentioned in the docs for not acceptable risks of pausing of external protocols.
if a protocol prevents issues greater than the service they provide
In this case the protocol (the plugin) provides referrals feature, but when it gets deactivated swaps do not work as well. The Telcoin protocol may propose a new data to be signed where the referrer is removed, but then the referrer will lose their fee forever.
Impact
Code Snippet
DefiSwap
increaseClaimableBy()
AmirX._feeDispersal()
Tool used
Manual Review
Recommendation
AmirX
which tracks unclaimed referral fees andtotalUnclaimed
which tracks the total amount of unclaimed fees.defiPlugin.increaseClaimableBy()
, check if the plugin is deactivated and if it's:active
-> do the same as nowinactive
-> do not call the plugin, but increase the mapping value andtotalUnclaimed
. Then account for the total unclaimed when returning TELCOIN to the safe.increaseClaimableBy()
when the plugin gets activated again.