It was noted that the reason the protocol decided to implement the balance check in the following implementation is due to fee-on-transfer tokens like USDT. They stated that they were going to accept all ERC20 tokens. However, this implementation also opens up another vulnerability that the protocol is currently not aware of.
The vulnerability involves a malicious intent by an attacker to disrupt the smooth operation of the protocol by front-running and observing transactions before sending dust amounts to user addresses or protocol-specific important contracts. This could lead to a temporary DoS, but could also be implemented on a large scale.
The TokenManager::withdraw
function allows the transfer of both ERC20 tokens and native tokens. It facilitates the transfer from the capital pool to msg.sender
. However, while making this transfer call, it invokes an internal _transfer
function that checks the protocol-specific contract (_capitalPoolAddr) fromBalanceBef
and fromBalanceAft
to ensure that there was no fee on transfer when users send funds into the _capitalPoolAddr
, which is a sound logic. But this opens up a path for an attacker to send in dust amounts to break this logic.
An attacker could monitor transactions in the mempool and send in dust amounts before the transaction gets added to a block and the state changes.
The same issue is possible with the (toBalanceAft != toBalanceBef + _amount)
check.
Code snippet
Temporary DOS to the protocol and it users
Restructure the logic and make new provisions for transfer
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.