User can avoid losing his Guild tokens by moving them out of the gauge before notifyLoss is called #582
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-877
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/tokens/GuildToken.sol#L123-L129
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/tokens/GuildToken.sol#L212-L217
Vulnerability details
Impact
Since all operations are performed on the blockchain savvy users can move funds from a soon-to-be-slashed gauge before
notifyLoss
is called, as a result users are able to put their Guild tokens into riskier gauges without suffering the consequences.Proof of Concept
If the LendingTerm has a bad debt, it will be auctioned, after auction is completed we cover our losses and call
notifyLoss
on the affected gauge/termhttps://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/loan/LendingTerm.sol#L789-L798
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/governance/ProfitManager.sol#L305
preventing users from withdrawing their funds out of it without first burning their Guild tokens.
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/tokens/GuildToken.sol#L123
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/tokens/GuildToken.sol#L212-L217
Since this is a lengthy process, users can move tokens out of the gauge long before the auction is over, moreover, it is possible to frontrun the
AuctionHouse.bid
transaction and withdraw tokens at the last moment.Test case for
AuctionHouse.t.sol
, add a repayment delayhttps://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/test/unit/loan/AuctionHouse.t.sol#L80
Tools Used
Foundry
Recommended Mitigation Steps
Perhaps we should freeze all weight operations during the auction, however users can still frontrun
AuctionHouse.startAuction
Assessed type
MEV
The text was updated successfully, but these errors were encountered: