FeeBurner initiates swap without any slippage checks if Chainlink oracle fails #44
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/tokenomics/FeeBurner.sol#L43-L88
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/swappers/SwapperRouter.sol#L414-L425
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/swappers/SwapperRouter.sol#L439
Vulnerability details
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
FeeBurner.burnToTarget()
_minTokenAmountOut()
to determinemin_out
parameter.minTokenAmountOut()
returns0
when Chainlink oracle failsTools Used
none
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 themin_out
value and you don't have to worry about chainlinkThe text was updated successfully, but these errors were encountered: