Unlock: free UDT arbitrage opportunity
The protocol relies on a single slow-updating price oracle for its UDT token, and its token distribution logic rewards referrers. An attacker could buy many keys across multiple locks to obtain UDT, sell it on an exchange where the price is higher, then request refunds, repeating until prices converge.
Submitted by itsmeSTYJ
Uniswap v2 made oracle attacks much more expensive to execute (since it needs to be manipulated over X number of blocks) however its biggest drawback is that it reacts slow to price volatility (depends on how far back you look). Depending on a single oracle is still very risky and can be exploited given the correct conditions.
Assuming the ideal conditions, it is possible to purchase many keys across many locks for the UDT token that is distributed to the referrer and sell them on some other exchanges where the price of UDT is higher; high enough such that the malicious user can still profit even after requesting for a refund (w/ or w/o a free trial).
Proof of Concept
This exploit is made possible because of:
- the over dependency on a single price oracle
- UDT token distribution logic is flawed
The following assumptions has to be true for this attack to work:
- price of UDT on an exchange is much higher than that from the price retrieved from the
uniswapOracle. - Since the price retrieved by
udtOracle.updateAndConsult()only updates once per day, it is slow to react to the volatility of UDT price movements. - Malicious user creates a lock and buys many keys across multiple addresses.
- Malicious user sells these UDT tokens on the exchanges w/ the higher price.
- Malicious user requests for a refund on the keys owned.
- Repeat until it is no longer profitable i.e. price on other exchanges become close to parity with the price retrieved by the
uniswapOracle.
Recommended Mitigation Steps
- Use the average of multiple oracle sources so that the price of UDT tokens (from
Unlock.sol’s PoV) reacts faster. - UDT tokens distributed based on the duration of key ownership.
julien51 (Unlock Protocol) disagreed with severity and commented:
As you noted this is pretty theoretical and given that the amount of UDT minted is capped to the gas spent, the user will need to 1) purchase a LOT of keys and 2) cancel them all and 3) find an exchange where the price is significantly different.
0xleastwood (judge) commented:
Nice find!
While, I do agree this is a difficult attack to perform, it is still a valid way of extracting value from the protocol. Hence, I believe this should be kept as
medium.
2 — Med (M): vulns have a risk of 2 and are considered “Medium” severity when assets are not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.
julien51 (Unlock Protocol) commented:
We will mitigate this in an upcoming upgrade by moving to Uniswap v3 for our oracles.
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 protocol over-depends on a single, slow-updating price oracle and has flawed UDT token distribution logic that allows arbitrage.
Impact
The attacker could extract value from the protocol by arbitraging the price difference, though the attack is difficult and requires specific conditions such as a significantly higher external price and the ability to buy and refund many keys.
What the attacker needed
Price of UDT on an exchange is much higher; oracle updates only once per day; attacker can create locks and buy keys; attacker can request refunds
The fix
The protocol should use the average of multiple oracle sources and distribute UDT tokens based on the duration of key ownership; the team later said they would mitigate by moving to Uniswap v3 for their oracles.
How it was found
- Create a lock and buy many keys across multiple addresses.
- Sell the UDT tokens on exchanges where the price is higher.
- Request a refund on the keys owned.
- Repeat until it is no longer profitable.
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 price oracle is a service that tells a smart contract the current price of a token. Here, the contract used only one oracle that updated slowly, so its price could differ a lot from other exchanges. The attacker could buy keys to get tokens at the oracle's low price, sell them elsewhere at a higher price, then get a refund on the keys, making a profit.