Closed sherlock-admin4 closed 8 months ago
1 comment(s) were left on this issue during the judging contest.
WangAudit commented:
path and impact are vague; unexpected behaviour? what does it mean exactly and the watson assumes it may results in a revert; therefore; not enough proof
turvec
medium
Protocol will behave unexpectedly if ss.origin is also the fee token
Summary
Protocol will behave unexpectedly if ss.origin is also the fee token
Vulnerability Detail
Protocol will behave unexpectedly if ss.origin specified in the
stablecoinSwap()
is also the fee token, this is because of the operation belowWhen the
defiSwap
gets called in the function, it eventually calls_feeDispersal()
which inturn calls_buyBack
to swap the feeToken to TELCOIN, this means the contract balance of the fee token gets reduced if it does has a balance amount > 0. There meaning that in the case where the balance of the feetoken is > 0, thefBalance - Balance
will underflow and revert. While some other transaction similar swap might pass depending on the contract balance of the fee token and when the time it was executed.Impact
Protocol will behave unexpectedly if ss.origin is also the fee token.
Code Snippet
https://github.com/sherlock-audit/2024-02-telcoin-platform-audit-update/blob/main/telcoin-contracts/contracts/swap/AmirX.sol#L91
Tool used
Manual Review
Recommendation
Completely prevent ss.origin from being the fee token. You should do this in the
_verifyStablecoin()
function