Attacker can slow down / halt the chain by queuing multiple stake removals or delegate stake removals
Source: https://github.com/sherlock-audit/2024-06-allora-judging/issues/56
Found by
imsrybr0, pks_
Summary
Attacker can slow down / halt the chain by queuing multiple stake removals or delegate stake removals.
Vulnerability Detail
All stake removals and delegate stake removals for a given block are processed in the EndBlocker in a loop.
Since there is no minimum restriction on the stake amount, an attacker can either :
- Depending on the registration fee, register multiple reputers, add a
1 uallostake to each one of them and then cancel his stakes for each one of them. - Delegate stake
1 uallofrom multiple addresses to each registered reputer then cancel all of them.
Impact
Slow down / halt the chain.
Code Snippet
func EndBlocker(ctx context.Context, am AppModule) error {
sdkCtx := sdk.UnwrapSDKContext(ctx)
blockHeight := sdkCtx.BlockHeight()
sdkCtx.Logger().Debug(
fmt.Sprintf("\n ---------------- Emissions EndBlock %d ------------------- \n",
blockHeight))
// Remove Stakers that have been wanting to unstake this block. They no longer get paid rewards
RemoveStakes(sdkCtx, blockHeight, am.keeper) // <===== Audit
RemoveDelegateStakes(sdkCtx, blockHeight, am.keeper) // <===== Audit
// ...
}
func RemoveStakes(
sdkCtx sdk.Context,
currentBlock int64,
k emissionskeeper.Keeper,
) {
removals, err := k.GetStakeRemovalsForBlock(sdkCtx, currentBlock) // <===== Audit
if err != nil {
sdkCtx.Logger().Error(fmt.Sprintf(
"Unable to get stake removals for block %d, skipping removing stakes: %v",
currentBlock,
err,
))
return
}
for _, stakeRemoval := range removals { // <===== Audit
// ...
}
}
func RemoveDelegateStakes(
sdkCtx sdk.Context,
currentBlock int64,
k emissionskeeper.Keeper,
) {
removals, err := k.GetDelegateStakeRemovalsForBlock(sdkCtx, currentBlock) // <===== Audit
if err != nil {
sdkCtx.Logger().Error(
fmt.Sprintf(
"Unable to get stake removals for block %d, skipping removing stakes: %v",
currentBlock,
err,
))
return
}
for _, stakeRemoval := range removals { // <===== Audit
// ...
}
}
Tool used
Manual Review
Recommendation
Process stake removals and delegate stake removals that reached maturity in batches with a predefined size over multiple blocks.
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/allora-network/allora-chain/pull/469
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A high-severity doS bug in Allora. Sherlock made it public on 10 August 2024. Found in the 454 audit contest (finding H-8), also found by 1 other warden.
About DoS
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.