Limited Voting Options Allow Ballot Creation Spam
Certain voting message types only allow a success observation vote, so a compromised observer can create spam ballots with false observations that honest observers cannot counter-vote. This lets the spammer avoid slashing while forcing honest observers to process the ballots.
ciphermarco Follow with deliriusz and zhaojie
Originally disclosed on Code4rena
Submitted by ciphermarco (1, 2), also found by deliriusz, and zhaojie
The message functions for certain types of voting allow only successful observation votes. This creates a problem if a compromised or faulty observer creates spam ballots with false observations. In this situation, honest observers have to spend resources processing the ballot but cannot cast an opposite vote to slash the spammer when the ballot reaches maturity.
Theoritically, a similar situation could happen with all ballots that do not reach the threshold. But in non-vulnerable cases, honest observer can cast an opposite vote to make the ballot reach threshold and be accounted for slashing. The real issue comes when honest observers cannot cast the honest opposite vote.
Proof of Concept
For certain types of votes, the only vote that is possible to be cast is an VoteType_SuccessObservation.
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_SuccessObservation)
ballot, err = k.AddVoteToBallot(ctx, ballot, vote.Creator, types.VoteType_SuccessObservation)
ballot, err = k.AddVoteToBallot(ctx, ballot, msg.Creator, types.VoteType_SuccessObservation)
A compromised or faulty observer can then create ballots for spam observations that do not exist, and honest observers can never vote for the opposite option. Since the ballot’s threshold will never be reached, the ballot will remain with the status BallotStatus_BallotInProgress.
Eventually, the ballot will be processed when the DistributeObserverRewards function gathers the list of matured ballots.
ballotIdentifiers := keeper.GetObserverKeeper().GetMaturedBallotList(ctx)
But, since BuildRewardsDistribution does not account for ballots with status BallotStatus_BallotInProgress, the ballot spammer will have a totalRewardUnits == 0 instead of a negative value. This way, no slashing will be executed as a punishment for the false observation, but observers will have to process the spam observation ballot anyway.
func (m Ballot) BuildRewardsDistribution(rewardsMap map[string]int64) int64 {
totalRewardUnits := int64(0)
switch m.BallotStatus {
case BallotStatus_BallotFinalized_SuccessObservation:
// ... SNIP ...
case BallotStatus_BallotFinalized_FailureObservation:
// ... SNIP ...
return totalRewardUnits
The compromised observer is then free to create as many false observation ballots as he wishes, effectively spamming the network and draining honest observer’s resources without a punishment.
Additional Note
Besides wasting network participant’s execution resources, the ballots are never deleted from storage after the distribution. But there is a comment evidencing this is an obviously known issue and, thus, included as merely a reminder in this report.
// TODO : Delete Ballots after distribution
// https://github.com/zeta-chain/node/issues/942
Recommended Mitigation Steps
Similarly to what happens in other types of votes, allow honest observers to cast a negative observation vote if they wish. Thus, when the ballot reaches maturity and is processed for reward distribution, the dishonest or faulty observer is slashed to pay for any resources spent with the false observation.
This is how msg_tss_voter.go and keeper_cross_chain_tx_vote_outbound_tx.go work:
if msg.Status == common.ReceiveStatus_Success {
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_SuccessObservation)
if err != nil {
return &types.MsgCreateTSSVoterResponse{}, err
}
} else if msg.Status == common.ReceiveStatus_Failed {
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_FailureObservation)
if err != nil {
return &types.MsgCreateTSSVoterResponse{}, err
}
}
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.ConvertReceiveStatusToVoteType(msg.Status))
if err != nil {
return nil, err
}
Special attention must be give to ensure the corrected voting type’s Digest function output is generalised for all types of votes. Similarly to what is done with MsgVoteOnObservedOutboundTx.
func (msg *MsgVoteOnObservedOutboundTx) Digest() string {
// ... SNIP ...
// Set status to ReceiveStatus_Created to make sure both successful and failed votes are added to the same ballot
m.Status = common.ReceiveStatus_Created
// ... SNIP ...
lumtis (ZetaChain) acknowledged
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 vote-handling code hardcodes the success observation vote type for certain messages, preventing honest observers from casting an opposite vote to reach the threshold and trigger slashing.
Impact
A compromised or faulty observer can spam the network with false observation ballots, draining honest observers' resources without being slashed.
What the attacker needed
Compromised or faulty observer
The fix
Allow honest observers to cast a negative observation vote for these vote types, so that when the ballot matures the dishonest observer is slashed.
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 this system, observers vote on whether something happened. For some vote types, the only vote you can cast is 'success', so if a bad observer claims something happened, honest observers cannot vote 'failure' to cancel it. The bad observer avoids punishment and wastes everyone else's effort.
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.