Closed sherlock-admin2 closed 1 month ago
reserveHatch
secures a window in which liquidation is possible. Its cooldown period of 20 blocks is chosen carefully so its impact on kicking liquidations is reasonable (especially given that Maker oracles are already delayed).
zhoo
Medium
Attackers can prevent liquidation
Summary
locker by calling
LockstakeEngine.lock
causesonKick -> VoteDelegate.free
to fail. This leads to the failure of liquidation.Root Cause
onKick -> _selectVoteDelegate -> VoteDelegateLike(prevVoteDelegate).free(wad) -> chief.free(wad) -> require(block.number > last[msg.sender])
onKick
will eventually callchief.free
. Ifchief.lock
is called, the call tochief.free
will fail in the same block, soonKick
will fail.If
onKick
cannot be called, the liquidation fails.https://etherscan.io/address/0x0a3f6849f78076aefadf113f5bed87720274ddc0#code
reserveHatch
preventsVoteDelegate.lock
from being called multiple times, but the attacker can still call it in a certain time interval.When block.number > hatchTrigger + HATCH_SIZE and block.number < hatchTrigger + HATCH_SIZE + HATCH_COOLDOWN
If liquidation occurs at this point, the user can avoid liquidation by calling the
lock
function.The liquidation was not carried out in time, and if the price continued to fall it would result in the loss of user funds.
LockstakeEngine.lock
can be called by anything, and an attacker can call this function by locking a small number of tokens.https://github.com/sherlock-audit/2024-06-makerdao-endgame/blob/dba30d7a676c20dfed3bda8c52fd6702e2e85bb1/vote-delegate/src/VoteDelegate.sol#L98
https://github.com/sherlock-audit/2024-06-makerdao-endgame/blob/dba30d7a676c20dfed3bda8c52fd6702e2e85bb1/lockstake/src/LockstakeEngine.sol#L426
Internal pre-conditions
External pre-conditions
Attack Path
The attackers found out that someone was going to be liquidated. The attacker uses
front-runnig
to invokeLockstakeEngine.lock
beforeonKick
is invoked. TheonKick
call fails and the attacker prevents himself from being liquidated. The attack may fail depending on the value of thehatchTrigger
, but it can also be successful in 1 block or 20 blocks(HATCH_COOLDOWN = 20).Impact
Causes a liquidation failure within the time limit allowed by hatchTrigger. Failure to settle in a timely manner may result in a loss of the funds (asset prices continue to fall)
PoC
No response
Mitigation
Allow the clearing module to call
chieft.free
without relying onhatchTrigger
checks.Duplicate of #62