Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 2.15 KB

081.md

File metadata and controls

43 lines (25 loc) · 2.15 KB

Gorgeous Jade Falcon

High

Swapper Role will Cause Loss of Contract Funds in Fee-On-Transfer Token Scenarios

Summary

A lack of adjustment for fee-on-transfer tokens will cause an ongoing loss of funds for the contract as the swapper role calls _buyBack, feeDispersal, and _stablecoinSwap, which do not account for fee deductions on transfers.

Root Cause

  1. _buyBack: 224 lacks logic to account for tokens that charge fees on transfers.
  2. _feeDispersal: 183 omits validation for reduced token amounts from fees.
  3. _stablecoinSwap in StablecoinHandler.sol: 144 does not handle deductions on fee-on-transfer tokens.

Internal pre-conditions

  1. Swapper role needs to initiate a swap or buyback with a fee-on-transfer token.
  2. The contract holds fee-on-transfer tokens that are processed through one of these functions.

External pre-conditions

  1. Fee-on-transfer token deducts a percentage from each transfer.
  2. No adjustments in the code for receiving the reduced amounts.

Attack Path

  1. Swapper role initiates a buyback or swap with a fee-on-transfer token.
  2. The transfer takes place, reducing the actual token amount by a fee.
  3. The contract performs the operation with the deducted token amount, resulting in a silent loss of funds.

Impact

The protocol suffers an ongoing loss of any tokens transferred with a fee. Depending on usage, this could accumulate into a significant amount over time, reducing available funds for swaps and buybacks.

PoC

No response

Mitigation

Update _buyBack, feeDispersal, and _stablecoinSwap to adjust for reduced token balances after transfers. Add checks to verify the received amount and recalibrate the expected amount for each transaction