UNISWAP_FEE is hardcoded which will lead to significant losses compared to optimal routing
The yield manager hardcoded a single Uniswap fee tier, so swaps routed through ETH always used the 1% ETH/USDC pool instead of cheaper pools. This produced non-optimal routes and a significant loss of revenue for the protocol.
Submitted by Picodes, also found by hickuphh3
In YieldManager, UNISWAP_FEE is hardcoded, which reduce significantly the possibilities and will lead to non optimal routes. In particular, all swaps using ETH path will use the wrong pool as it will use the ETH / USDC 1% one due to this line.
Proof of Concept
For example for CRV / USDC, the optimal route is currently CRV -> ETH and ETH -> USDC, and the pool ETH / USDC with 1% fees is tiny compared to the ones with 0.3 or 0.1%. Therefore using the current implementation would create a significant loss of revenue.
Recommended Mitigation Steps
Basic mitigation would be to hardcode in advance the best Uniswap paths in a mapping like it’s done for Curve pools, then pass this path already computed to the swapping library. This would allow for complex route and save gas costs as you would avoid computing them in swapExactTokensForTokens.
Then, speaking from experience, as distributeYield is onlyAdmin, you may want to add the possibility to do the swaps through an efficient aggregator like 1Inch or Paraswap, it will be way more optimal.
sforman2000 (Sturdy) confirmed
Fix the issue of hardcoded UNISWAP_FEE sturdyfi/code4rena-may-2022#12
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
Root cause
Likely the swap adapter hardcodes a single Uniswap fee constant instead of selecting or receiving the best pool and route for each token pair.
Impact
Swaps through the ETH path would use a tiny 1% fee pool, causing a significant loss of revenue compared to optimal routing.
What the attacker needed
Admin-only yield distribution; hardcoded fee tier in adapter
The fix
The fee and route should be precomputed and passed in, or swaps should go through an aggregator; the report notes the team confirmed and linked a fix.
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.
A decentralised exchange like Uniswap splits trades across pools that charge different fees, and the cheapest pool is usually the best one to use. This code always picked one fixed fee level, so trades went through an expensive, small pool even when a cheaper one existed. The result is that the protocol got less money than it should from each swap.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.