Skip to content
DoS Audit finding Advanced

Chain halt as VerifyVoteExtensionHandler is not guaranteed to run

A validator can inject an invalid vote extension that is not re-validated by the application logic, causing the next block proposer to include it and ProcessProposalHandler to fail repeatedly, halting the chain.

Boy2000 Follow with stuart_the_minion

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/30

Found by

Boy2000, stuart_the_minion

Summary

Late/slow precommit votes, after +2/3 votes do not trigger VerifyVoteExtensionHandler. ProcessProposalHandler expects all vote extensions to be valid. Single malicious/misbehaving validator can inject invalid vote extension to the (previous) block, resulting in chain halt.

Root Cause

  1. PrepareProposal does not re-verify/ignore invalid LocalLastCommit votes

https://github.com/sherlock-audit/2024-12-seda-protocol/blob/main/seda-chain/app/abci/handlers.go#L177

Go
func (h *Handlers) PrepareProposalHandler() sdk.PrepareProposalHandler {
	return func(ctx sdk.Context, req *abcitypes.RequestPrepareProposal) (*abcitypes.ResponsePrepareProposal, error) {
		// Check if there is a batch whose signatures must be collected
		// at this block height.
		var collectSigs bool
		_, err := h.batchingKeeper.GetBatchForHeight(ctx, ctx.BlockHeight()+BlockOffsetCollectPhase)
		if err != nil {
			if !errors.Is(err, collections.ErrNotFound) {
				return nil, err
			}
		} else {
			collectSigs = true
		}

		var injection []byte
		if req.Height > ctx.ConsensusParams().Abci.VoteExtensionsEnableHeight && collectSigs {
			err := baseapp.ValidateVoteExtensions(ctx, h.stakingKeeper, req.Height, ctx.ChainID(), req.LocalLastCommit)
			if err != nil {
				return nil, err
			}

@>			injection, err = json.Marshal(req.LocalLastCommit)
			if err != nil {
				h.logger.Error("failed to marshal extended votes", "err", err)
				return nil, err
			}

			injectionSize := int64(len(injection))
			if injectionSize > req.MaxTxBytes {
				h.logger.Error(
					"vote extension size exceeds block size limit",
					"injection_size", injectionSize,
					"MaxTxBytes", req.MaxTxBytes,
				)
				return nil, ErrVoteExtensionInjectionTooBig
			}
			req.MaxTxBytes -= injectionSize
		}

		defaultRes, err := h.defaultPrepareProposal(ctx, req)
		if err != nil {
			h.logger.Error("failed to run default prepare proposal handler", "err", err)
			return nil, err
		}

		proposalTxs := defaultRes.Txs
		if injection != nil {
			proposalTxs = append([][]byte{injection}, proposalTxs...)
			h.logger.Debug("injected local last commit", "height", req.Height)
		}
		return &abcitypes.ResponsePrepareProposal{
			Txs: proposalTxs,
		}, nil
	}
}
  1. ProcessProposalHandler expects all votes (batches) to be valid/verified

https://github.com/sherlock-audit/2024-12-seda-protocol/blob/main/seda-chain/app/abci/handlers.go#L235

Go
func (h *Handlers) ProcessProposalHandler() sdk.ProcessProposalHandler {
	return func(ctx sdk.Context, req *abcitypes.RequestProcessProposal) (*abcitypes.ResponseProcessProposal, error) {
		if req.Height <= ctx.ConsensusParams().Abci.VoteExtensionsEnableHeight {
			return h.defaultProcessProposal(ctx, req)
		}

		batch, err := h.batchingKeeper.GetBatchForHeight(ctx, ctx.BlockHeight()+BlockOffsetCollectPhase)
		if err != nil {
			if errors.Is(err, collections.ErrNotFound) {
				return h.defaultProcessProposal(ctx, req)
			}
			return nil, err
		}

		var extendedVotes abcitypes.ExtendedCommitInfo
		if err := json.Unmarshal(req.Txs[0], &extendedVotes); err != nil {
			h.logger.Error("failed to decode injected extended votes tx", "err", err)
			return nil, err
		}

		// Validate vote extensions and batch signatures.
		err = baseapp.ValidateVoteExtensions(ctx, h.stakingKeeper, req.Height, ctx.ChainID(), extendedVotes)
		if err != nil {
			return nil, err
		}

		for _, vote := range extendedVotes.Votes {
			// Only consider extensions with pre-commit votes.
			if vote.BlockIdFlag == cmttypes.BlockIDFlagCommit {
				err = h.verifyBatchSignatures(ctx, batch.BatchNumber, batch.BatchId, vote.VoteExtension, vote.Validator.Address)
				if err != nil {
@>					h.logger.Error("proposal contains an invalid vote extension", "vote", vote)
					return nil, err
				}
			}
		}

		req.Txs = req.Txs[1:]
		return h.defaultProcessProposal(ctx, req)
	}
}

Internal Pre-conditions

External Pre-conditions

Attack Path

  1. Malicious/misbehaving validator late-injects invalid vote at the right height (when there is a batch to sign, to not return early due to 0 batches). Alternatively optimistically sends invalid votes continuously.
  2. The vote is not validated (with app logic) and is added to LocalLastCommit.
  3. Next block proposer -> propose block with invalid vote -> ProcessProposalHandler repeatedly fails.

Impact

Chain halt

PoC

No response

Mitigation

No response

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/sedaprotocol/seda-chain/pull/531

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

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 PrepareProposalHandler does not re-verify or ignore invalid vote extensions from LocalLastCommit, so an invalid vote can be included in a block and later cause ProcessProposalHandler to fail.

What the attacker needed

A validator (malicious or misbehaving); A batch to sign at the target height

The fix

The issue was fixed by the protocol team in a pull request.

How it was found

  1. A malicious or misbehaving validator late-injects an invalid vote extension at a height where a batch exists to sign.
  2. The invalid vote is not validated by the application logic and is added to LocalLastCommit.
  3. The next block proposer includes the invalid vote in the proposed block.
  4. ProcessProposalHandler repeatedly fails when processing the block, leading to a chain halt.

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 blockchain relies on validators to agree on blocks. If one validator sends a malformed vote that is not properly checked, the next block proposer may include it, and other validators will reject the block, stopping the chain.

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.

More by Boy2000

View all

3 more disclosed reports, best first.

More from SEDA Protocol

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.