Skip to content
Business logic Audit finding Intermediate

Executors/Proxies can game the rewards system by using a pubkey that will be sorted first

The rewards system sorts executor and proxy public keys in ascending order before allocating gas rewards, so an attacker can generate keys that sort first and always be prioritized for rewards even when providing the same value as others.

g Follow with zxriptor

Originally disclosed on Sherlock

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

Found by

g, zxriptor

Summary

The reveals and proxy pubkeys are sorted in ascending order every time data requests are filtered and tallied. The same ordering is used when metering gas for Proxies and Executors. Proxies and Executors that are sorted first will be prioritized for rewards distribution.

Root Cause

In FilterAndTally():185-197, the reveals are sorted in ascending order by their executor's key while the ProxyPubkeys of each reveal are also sorted in ascending order.

GOLANG
  keys := make([]string, len(req.Reveals))
  i := 0
  for k := range req.Reveals {
    keys[i] = k
    i++
  }
  sort.Strings(keys)

  reveals := make([]types.RevealBody, len(req.Reveals))
  for i, k := range keys {
    reveals[i] = req.Reveals[k]
    sort.Strings(reveals[i].ProxyPubKeys)
  }

When metering gas for proxies, the proxies are allocated gas in the same order until there is no remaining execution gas. Proxies with pubkeys that are ordered first will be prioritized.

The same behavior applies when metering gas for executors.

Internal Pre-conditions

None

External Pre-conditions

None

Attack Path

  1. A Proxy/Executor will generate and use public keys that will be ordered first when sorted.
  2. When gas rewards are allocated and distributed, they will always be prioritized over others.

Impact

The rewards system can be gamed so that certain Executors/Proxies will always be prioritized for rewards even when all participating proxies/executors provide the same value.

PoC

None

Mitigation

Consider randomizing the order of the executors' and proxies' public keys when allocating their rewards.

Discussion

sherlock-admin2

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

The original report as published on Sherlock, by g. 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

The code sorts executor and proxy public keys in ascending order before allocating gas rewards, without randomisation, allowing participants to choose keys that sort first.

Impact

The rewards system can be gamed so that certain Executors/Proxies will always be prioritized for rewards even when all participating proxies/executors provide the same value.

What the attacker needed

Ability to generate public keys; participation as a Proxy or Executor

The fix

The protocol team fixed this issue by randomizing the order of the executors' and proxies' public keys when allocating their rewards.

How it was found

  1. A Proxy/Executor generates and uses public keys that will be ordered first when sorted.
  2. When gas rewards are allocated and distributed, they are always prioritized over others.

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 a blockchain-based rewards system, participants are paid based on the order they are processed. If the system always processes them alphabetically by their public key, someone can create a key that starts with early letters to always get paid first. This lets them unfairly take rewards ahead of others who did the same work.

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.

More by g

View all

23 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.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.