Updating the state
The emergency withdraw function fails to reset the user's bonus ratio and duration ratio, leaving stale values. An attacker could later claim funds with an incorrect ratio if the contract exits the emergency state.
Submitted by jah, also found by securerodd
In the Emergency withdraw function userCurrentBonusRatio and durationRatio aren’t update which will user clime funds with the wrong ratio.
Proof of Concept
Recommended Mitigation Steps
Set these variables to zero in the EmergencyWithdraw function.
Kogaroshi (Paladin) disagreed with High severity and commented:
PR with the changes: PaladinFinance/Paladin-Tokenomics#5.
Contesting the severity of the issue: even after an emergency withdraw, where the BonusRatio of the user isn’t reset back to 0, users have no way to claim extra accrued rewards, as the claim method will be blocked by the Emergency state: HolyPaladinToken.sol#L381.
0xean (judge) decreased severity to Medium and commented:
Given that the contract can be moved back out of the emergency state, I don’t think the sponsor’s assessment of this being a low risk issue is correct. I do think due to the external circumstances required for this to be achieved that it probably best qualifies as a medium risk.
2 — Med: Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The emergency withdraw function does not reset the user's bonus ratio and duration ratio to zero.
Impact
If the contract is moved out of the emergency state, a user could claim funds with the wrong ratio, potentially leaking value; the judge rated this medium severity.
What the attacker needed
Contract must be in emergency state; contract must later exit emergency state
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you withdraw in an emergency, the contract should reset your bonus and duration multipliers to zero. Here it doesn't, so if the contract later leaves emergency mode, you might claim rewards using old, incorrect multipliers. This could let someone get more funds than they should.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.