closeTrove
never nulls trove.stake
#581
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-02-ethos/blob/73687f32b934c9d697b97745356cdf8a1f264955/Ethos-Core/contracts/TroveManager.sol#L1278-L1293
Vulnerability details
// Auditor's note: not 100% sure if this is intentional, but I have reason to believe it's a mistake.
Description
When a trove gets liquidated, its stake gets set to 0 (through
_removeStake
, called eg here). However, when a trove gets closed gratiously through_closeTrove
, the stake is never nulled.Exploit scenario
Not nulling a stake could cause unforseen consequences if other areas of the code assume that a non-existent (closed) trove doesn't have a stake.
Recommendation
Either ensure all data relating to a trove gets nulled on closure, or provide documentation (code comments) for why th following invariant doesn't hold:
TroveOwners
).The text was updated successfully, but these errors were encountered: