Skip to content
Business logic Audit finding Intermediate

Users Can Bypass Emergency Restrictions on updateUserRewardState()

The emergency withdrawal feature is meant to freeze reward accrual, but a user can still update their rewards by transferring a small amount of unlocked tokens. This lets them keep earning rewards during the emergency, potentially claiming a larger share of allocated rewards.

leastwood Follow

Originally disclosed on Code4rena

Submitted by leastwood

HolyPaladinToken.sol#L1338-L1378 HolyPaladinToken.sol#L876-L906

The emergencyWithdraw() function intends to withdraw their tokens regardless if they are locked up for any duration. This emergency must be triggered by the owner of the contract by calling triggerEmergencyWithdraw(). A number of functions will revert when the protocol is in an emergency state, including all stake, lock, unlock and kick actions and the updating of a user’s rewards. However, a user could bypass the restriction on _updateUserRewards() by transferring a small amount of unlocked tokens to their account. _beforeTokenTransfer() will call _updateUserRewards() on the from and to accounts. As a result, users can continue to accrue rewards while the protocol is in an emergency state and it makes sense for users to delay their emergency withdraw as they will be able to claim a higher proportion of the allocated rewards.

Recommended Mitigation Steps

Consider adding a check for the boolean emergency value in _beforeTokenTransfer() to not call _updateUserRewards on any account if this value is set. Alternatively, a check could be added into the _updateUserRewards() function to return if emergency is true.

Kogaroshi (Paladin) confirmed, resolved, and commented:

Changes made in the commit: PaladinFinance/Paladin-Tokenomics@ce9a4e2. (made in this PR so we can use Custom Errors directly)


The original report as published on Code4rena, by leastwood. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

Likely the token transfer hook calls the reward update function without checking the emergency flag, so transfers bypass the intended restriction.

Impact

Users can continue to accrue rewards during an emergency, which may let them claim a higher proportion of allocated rewards.

What the attacker needed

Protocol in emergency state; user holds unlocked tokens

The fix

The issue was fixed by adding a check for the emergency flag in the token transfer hook or reward update function.

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.

A smart contract has an emergency mode that is supposed to stop people from earning rewards. But the code that updates rewards also runs when tokens are transferred, so a user can send a tiny amount of tokens to themselves and still get rewards. This means the emergency stop does not fully work.

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.

More by leastwood

View all

70 more disclosed reports, best first.

More from Paladin - Warden Pledges contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.