`slash()` can be frontrunned to avoid the penalty imposed on them
A user facing a slashing penalty can front-run the slash or pause transaction by calling fullClaimAndExit to withdraw all funds before the penalty applies. This allows the slashing mechanism to be bypassed.
Source: https://github.com/sherlock-audit/2022-11-telcoin-judging/issues/45
Found by
cccz, hickuphh3, yixxas
Summary
I believe slash() is used to take funds away from a user when they misbehave. However, a malicious user can frontrun this operation or the pause() function and call fullClaimAndExit() to fully exit before the penalty can affect them.
Vulnerability Detail
Malicious users who have intentionally committed some offenses that would lead to getting slashed can listen to the mempool and frontrun the slash() or pause() function call by the protocol to protect all his assets before slashing can happen.
Impact
Slashing mechanism implemented can be bypassed by malicious user.
Code Snippet
https://github.com/sherlock-audit/2022-11-telcoin/blob/main/contracts/StakingModule.sol#L403-L406
https://github.com/sherlock-audit/2022-11-telcoin/blob/main/contracts/StakingModule.sol#L202-L207
Tool used
Manual Review
Recommendation
I implore the sponsors to explore alternatives to this slashing mechanism as they can be easily bypassed, especially so by sophisticated users who presumably are the ones who will be getting slashed.
Discussion
amshirif
https://github.com/telcoin/telcoin-staking/pull/21
jack-the-pug
Fix confirmed
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 contract allows users to withdraw all funds at any time without a delay or lock, so a user can exit before a pending slashing or pause transaction is mined.
Impact
The slashing mechanism can be bypassed by a malicious user, allowing them to avoid penalties.
What the attacker needed
User has staked funds; user can monitor the mempool; user can send a transaction before the slash
The fix
The report recommends exploring alternatives to the slashing mechanism because it can be easily bypassed; a fix was later confirmed.
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.
In some blockchain systems, a user can be penalised by having some of their staked funds taken away (called slashing). This report shows that a user can watch for the penalty transaction and quickly send their own transaction to withdraw everything first, so the penalty never touches their money.
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.