sherlock-2024-01-ubiquity-m02
[M-02] UbiquityPool::mintDollar/redeemDollar collateral depeg will encourage using UbiquityPool to swap for better collateral
Summary
담보 토큰이 디페깅되는 경우, 사용자들은 디페깅된 담보(상태가 나쁜 담보)를 넣고 상태가 좋은 담보를 꺼내갈 것이다. 디페깅된 담보만 쌓이기 때문에 이는 궁극적으로 uAD의 디페깅을 야기한다.
Keyword
depegging, stablecoin, chainlink oracle, price oracle, business logic vul, staled oracle
Vulnerability
체인링크 가격 피드는 실제 DEX에서의 가격보다 약간 뒤처질 수 있다. 디페깅된 토큰(DAI라고 하자)을 보유한 사용자는 DAI를 예치하고 uAD를 민팅, uAD를 사용하여 디페깅되지 않은 담보(LUSD라 하자)를 꺼내갈 수 있다. 체인링크 가격을 사용하여 uAD 수수료만 제하고 스왑하는 것과 마찬가지이기 때문에, 유저는 DEX보다 더 나은 거래를 할 수 있다. 결과적으로 Uniquity에는 디페깅된 담보로 채워지고, 상태가 좋은 담보는 고갈된다.
function mintDollar(
uint256 collateralIndex,
uint256 dollarAmount,
uint256 dollarOutMin,
uint256 maxCollateralIn
)
internal
collateralEnabled(collateralIndex)
returns (uint256 totalDollarMint, uint256 collateralNeeded)
{
...
// subtract the minting fee
@> totalDollarMint = dollarAmount
.mul(
UBIQUITY_POOL_PRICE_PRECISION.sub(
poolStorage.mintingFee[collateralIndex]
)
)
.div(UBIQUITY_POOL_PRICE_PRECISION);
...
}Impact
담보 토큰이 디페깅되면 사용자가 풀을 사용하여 다른 담보 토큰으로 스왑하기 때문에, uAD가 디페깅될 수 있다.
Mitigation
- 서로 다른 담보 간의 비율을 강제한다. (체인링크 피드를 사용하여 사용자가 슬리피지 없이 스왑할 수 있는 GMX 가격 결정 알고리즘과 유사함)
- 안전 발행 비율 사용(차입 프로토콜과 유사한 LTV 메커니즘)
- 체인링크 피드가 스테이블 코인에 대해 허용 가능한 임계값을 유지하도록 강제 (가격이 범위를 벗어날 경우 담보에 대한 작업을 revert 한다)
tags: bughunting, ubiquity, smart contract, solidity, chainlink oracle, price oracle, stablecoin, depegging, business-logic-vul, staled oracle, severity medium