InsertBulkReputerPayload can be DoS
The InsertBulkReputerPayload function does not verify the sender, allowing anyone to submit a valid bundle copied from the transaction pool. An attacker can front-run the original transaction with a subset of bundles, causing the original to fail due to nonce reuse and invalidating most reputer data.
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-06-allora-judging/issues/88
Found by
LZ_security
Summary
After discovering the InsertBulkReputerPayload transaction, the attacker initiates the same call to reduce the number of Valuebundles in the array of msg.ReputerValueBundles (keep only one), invalidate most of the Reputer's data.
Vulnerability Detail
-
InsertBulkReputerPayloaddoes not verifymsg.sender, so anyone can call it. -
InsertBulkReputerPayloadpasses throughmsg.ReputerValueBundlesand verifies thesignature.
for _, bundle := range msg.ReputerValueBundles {
if err := bundle.Validate(); err != nil {
continue
}
.....
}
func (bundle *ReputerValueBundle) Validate() error {
.....
// Check signature from the bundle, throw if invalid!
pk, err := hex.DecodeString(bundle.Pubkey)
if err != nil || len(pk) != secp256k1.PubKeySize {
return errors.Wrapf(sdkerrors.ErrInvalidRequest, "signature verification failed")
}
pubkey := secp256k1.PubKey(pk)
src := make([]byte, 0)
src, _ = bundle.ValueBundle.XXX_Marshal(src, true)
if !pubkey.VerifySignature(src, bundle.Signature) {
return errors.Wrapf(sdkerrors.ErrInvalidRequest, "signature verification failed")
}
}
But the problem is that attackers can gain access to that data by listening in on the transaction pool,
After discovering InsertBulkReputerPayload transaction, the attacker extracts data from one of the ReputerValueBundle,
then construct a new request,
If the request initiated by the attacker is executed before the current transaction, the transaction is executed successfully because the attacker's data is valid.
The old transaction, because the attacker's transaction has been executed nonce has been used, the old transaction execution failed.
func (ms msgServer) InsertBulkReputerPayload(
ctx context.Context,
msg *types.MsgInsertBulkReputerPayload,
) (*types.MsgInsertBulkReputerPayloadResponse, error) {
......
// Check if the reputer nonce is unfulfilled
reputerNonceUnfulfilled, err := ms.k.IsReputerNonceUnfulfilled(ctx, msg.TopicId, msg.ReputerRequestNonce.ReputerNonce)
if err != nil {
return nil, err
}
.....
// Update the unfulfilled nonces
_, err = ms.k.FulfillReputerNonce(ctx, msg.TopicId, msg.ReputerRequestNonce.ReputerNonce)
if err != nil {
return nil, err
}
// Update topic reward nonce
err = ms.k.SetTopicRewardNonce(ctx, msg.TopicId, msg.ReputerRequestNonce.ReputerNonce.BlockHeight)
if err != nil {
return nil, err
}
......
Impact
A DoS attack invalidates data submitted by the Reputer
Code Snippet
Tool used
Manual Review
Recommendation
Validate the msg.sender
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/allora-network/allora-chain/pull/458
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 missing check on msg.sender allows anyone to submit a valid bundle, and the nonce mechanism causes the original transaction to fail if a copy is processed first.
Impact
A DoS attack could invalidate most of the data submitted by the Reputer.
What the attacker needed
Access to transaction pool; ability to front-run transactions
The fix
The issue was fixed by validating the msg.sender.
How it was found
- Attacker listens to the transaction pool for InsertBulkReputerPayload transactions.
- Attacker extracts data from one ReputerValueBundle in a discovered transaction.
- Attacker constructs a new request with only that bundle.
- Attacker submits the new request so it executes before the original.
- The original transaction fails because its nonce is already used.
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.
This is a denial-of-service bug in a blockchain app. Anyone can copy a valid transaction from the waiting area, submit a smaller version first, and make the original fail, so the intended data never gets recorded.
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.