FeeBurner initiates swap without any slippage checks if Chainlink oracle fails
The FeeBurner contract initiates token swaps through SwapperRouter, which uses a Chainlink oracle to set a minimum output amount for slippage protection. If the oracle fails, the minimum output is set to zero, allowing an attacker to sandwich the swap and extract value.
Submitted by Ruhum
Impact
While the SwapperRouter contract isn’t explicitly in scope, it’s a dependency of the FeeBurner contract which is in scope. So I think it’s valid to make this submission.
The SwapperRouter contract uses the chainlink oracle to compute the minimum amount of tokens it should expect from the swap. The value is then used for the slippage check. But, if the chainlink oracle fails, for whatever reason, the contract uses 0 for the slippage check instead. Thus there’s a scenario where swaps initiated by the FeeBurner contract can be sandwiched.
Proof of Concept
- multiple swaps initiated through
FeeBurner.burnToTarget() - SwapperRouter calls
_minTokenAmountOut()to determinemin_outparameter. minTokenAmountOut()returns0when Chainlink oracle fails
Recommended Mitigation Steps
Either revert the transaction or initiate the transaction with a default slippage of 99%. In the case of Curve, you can get the expected amount through get_dy() and then multiply the value by 0.99. Use that as the min_out value and you don’t have to worry about chainlink
chase-manning (Backd) disputed and commented:
This is intended functionality. If there is no oracle for a token, we still want to swap it, even if this presents a possible sandwich attack. It should be rare for a token to not have an oracle, and when it does we would rather accept slippage as opposed to not being able to swap it at all.
Alex the Entreprenerd (judge) commented:
I acknowledge the sponsor reply that they want to offer a service to the end user in allowing any swappable token to be used.
While I believe the intent of the sponsor is respectable, the reality of the code is that it indeed allows for price manipulation and extraction of value, personally I would recommend end users to perform their own swaps to ensure a more reliable outcome.
That said, because the code can be subject to leak of value, I believe Medium Severity to be appropriate.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
Swaps initiated by FeeBurner can be sandwiched when the Chainlink oracle fails, leading to value extraction.
What the attacker needed
Chainlink oracle fails for a token; Swaps initiated via FeeBurner
The fix
The transaction should revert or use a default slippage of 99% (e.g., via Curve's get_dy()) when the oracle fails.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a contract swaps tokens, it should check that it receives at least a minimum amount to avoid being ripped off by price changes. Here, if a price feed (oracle) fails, the contract sets that minimum to zero, so an attacker can manipulate the price and steal value.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.