Description
One of the tokens intended for collateral within the protocol, PAXG
, utilizes a fee-on-transfer mechanism. However, this mechanism isn't compatible with the ERC20 logic in LiquidationPool
. Within the LiquidationPool::distributeAssets()
method, data is appended to the LiquidationPool::rewards
mapping to track the holder's rewards portion. However, when this portion is transferred to the LiquidationPool
on line 232, it leads to the pool balance being lower than the combined rewards portions stored in the mapping.
This discrepancy would cause a revert when the last holder attempts to claim their rewards using the LiquidationPool::claimRewards()
method due to insufficient funds in the LiquidationPool
. Notably, the earlier holders who have already claimed their rewards have implicitly compensated for their deducted transfer fees from the last holder's portion. This imbalance leads to the vulnerable aspect of this function, pinpointed specifically in line 175 of theLiquidationPool::claimRewards()
function.
Impact
This vulnerability poses a high risk as it affects PAXG
, a proposed collateral asset within the protocol. Failure to support such tokens could lead to user funds being inaccessible. Additionally, the protocol intends to utilize other ERC20 tokens in the future, which could potentially encounter the same issue. For instance, USDT
possesses a similar fee-on-transfer mechanism that is currently deactivated.
Proof of Concept
A code demonstration using Foundry to exhibit the inability of a holder to claim rewards can be accessed here.
Recommended Mitigation
To address such tokens, a suggested approach involves caching the LiquidationPool
balance before executing a transferFrom
to the contract. Subsequently, after the transfer, verifying the difference between the cached and current balances as the newly added balance.
Tools Used
Manual review
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.