codehawks-2023-07-dsc-m11

[M-11] Liquidators can be front-run to their loss

보고서

Summary

오라클을 조작하거나 프론트러닝을 하면 liquidate 함수 호출자(청산자)가 호출 시점에 원래 기대했던 것보다 더 적은 양의 담보 토큰을 받게 된다. 청산자가 기대하는 담보 토큰 최소값 파라미터를 받아 그 밑으로 떨어지면 revert 하도록 하자.

Keyword

oracle manipulation, frontrunning

Vulnerability

liquidate 함수는 담보가 부족한 유저의 담보를 청산자(다른 유저)가 자신의 DSC 토큰을 이용하여 청산할 수 있는 기능이다.

liquidate 함수는 오라클 조작과 프론트러닝에 취약하다. 오라클 조작이나 MEV 프론트러닝으로 인해 갑작스럽게 토큰 가격이 변동하면, 청산자는 예상보다 적은 담보 토큰을 얻게 된다.

Impact

청산자가 예상보다 적은 담보 토큰을 받게 된다.

Mitigation

liquidate 함수에 minimumOutputTokens 파라미터를 추가하여 청산자가 기대하는 최소량 이상의 토큰을 받지 못하면 revert 한다.

require(totalCollateralToRedeem >= minimumOutputTokens, "Too little collateral received.");

tags: bughunting, codehawks, smart contract, solidity, oracle manipulation, frontrunning, severity medium