Staked Credit Rewards can be unfairly divided because of MEV/Just-in-time deposits #864
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-994
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/ProfitManager.sol#L292
Vulnerability details
Vulnerability details
An attacker can use MEV (via gas auction or Flashbots or control of miners) to cause an unfair division of rewards. By providing a large (relative to the size of all other staked tokens) credit token deposit Just-in-Time before a
GAUGE_PNL_NOTIFIER
call toProfitManager.notifyPnL
theCREDIT
deposited by the attacker will receive a big portion of the rewards and the attacker can immediately withdraw their deposit after rewards are distributed.We assume this allows an attacker to get a lot of the rewards (in GUILD and CREDIT) even though they haven't provided any deposit that has been borrowed.
Impact
Credit holders get rewards, they have not earned
Proof of Concept
ProfitManager.notifyPnL
by theGAUGE_PNL_NOTIFIER role
.GAUGE_PNL_NOTIFIER
call toProfitManager.notifyPnL
happensTools Used
Manual review
Recommended Mitigation Steps
A good mitigation approach could use something like snapshotting who has deposited since the last reward distribution and only give these depositors rewards based on the size of their deposits the next time yield is distributed.
Assessed type
MEV
The text was updated successfully, but these errors were encountered: