Users can receive creditRewards
even when they are slashed
#759
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-262
grade-b
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/SurplusGuildMinter.sol#L249-L269
Vulnerability details
Impact
Whenever a term suffers a loss, the users(guild holders) of that term are slashed. Basically, they will not receive anything.
However, users are still able to receive
creditRewards
even when they are slashed.In the contract
SurplusGuildMinter
, the functiongetRewards()
is called whenever a user stakes or unstakes his credit tokens. i.e.https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/SurplusGuildMinter.sol#L249-L269
If the user has been slashed, then
guildReward
are set to zero i.e.However, we did not account for
creditReward
(when users are slashed), therefore, thecreditRewards
would be sent to the user wheneverguildReward
function is called i.e.This is an undesired behavior, and leads to loss of funds as the user is not supposed to receive the
creditReward
.Proof of Concept
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/SurplusGuildMinter.sol#L249-L269
Tools Used
Manual Review
Recommended Mitigation Steps
Consider updating the variable
creditReward
to zero in if the statement. i.e.Assessed type
Math
The text was updated successfully, but these errors were encountered: