[SECURITY][Minor] SDK - attestedTime ignores the node's 10-minute skew window, so a renewal can be aborted by the SDK or rejected by the node
Report
[SECURITY][Minor] SDK - attestedTime ignores the node's 10-minute skew window, so a renewal can be aborted by the SDK or rejected by the node
| Field | Value |
|---|---|
| Severity | Minor |
| Area | SDK — compute leasing (renewal) |
| Component | src/attestation.ts (attestedTime, gatherAttestations), src/xe.ts (renewLease) |
| Version | xeprotocol/sdk @ 0dbc92ecff709bee79768e4e37788c682a0f4525 (master, 2026-10-23) · xeprotocol/xe @ 978785929bc1 |
| Status | Reproduced (unit, deterministic) |
| Date | 2026-11-02 |
| Reporter | Desk web account xe:64e3ca3f…0cd4 (reporter id 68) — the same person who filed XE-0077 / XE-0078 / XE-0080 under the GitHub login targammm (reporter id 30). Please merge the two records so the award history is attributed once. |
1. Summary
A lease renewal is timed by a threshold of timekeeper attestations. The node computes the renewal time itself, from the attestations it accepts:
// core/attestation.go:53-107
func ValidateAttestations(attestations []TimekeeperAttestation, leaseHash string, config *TimekeeperConfig, skipSkew bool) (int64, error) {
...
for _, a := range attestations {
if !trusted[a.PublicKey] { continue }
if seen[a.PublicKey] { continue }
if err := VerifyAttestation(&a, leaseHash); err != nil { continue }
if !skipSkew {
delta := a.Timestamp - now
if delta < 0 { delta = -delta }
if delta > MaxAttestationSkew { continue } // <-- 10-minute window (line 47)
}
seen[a.PublicKey] = true
validTimestamps = append(validTimestamps, a.Timestamp)
}
if len(validTimestamps) < config.Threshold {
return 0, fmt.Errorf("only %d valid attestations from trusted timekeepers, need %d", len(validTimestamps), config.Threshold)
}
sort.Slice(validTimestamps, func(i, j int) bool { return validTimestamps[i] < validTimestamps[j] })
median := validTimestamps[(len(validTimestamps)-1)/2]
return median, nil
}
The SDK verifies the signature and the key membership — but not the skew window — and then takes the lower median over every attestation it gathered:
// src/attestation.ts:26-30
export function attestedTime(atts: Attestation[]): bigint {
if (atts.length === 0) throw new XeUsageError('attestedTime: no attestations')
const sorted = atts.map((a) => a.timestamp).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))
return sorted[Math.floor((sorted.length - 1) / 2)]!
}
The median rule itself matches the node exactly. The filter does not. So whenever a timekeeper's clock is more than 10 minutes off, the SDK's renewal time differs from the node's renewal time, and the SDK's renewal time is the one it acts on:
// src/xe.ts:457-465
const attestations = await this.#attest(leaseHash)
const renewTime = attestedTime(attestations)
if (renewTime >= lease.effectiveExpiry) {
throw new XeUsageError(`renewLease: lease expired at ${lease.effectiveExpiry} before the renewal was attested`)
}
...
const epoch = await this.#epochAt(renewTime)
2. Affected code
| File | Line | Issue |
|---|---|---|
src/attestation.ts |
26–30 | attestedTime — lower median over all gathered attestations, no skew filter |
src/attestation.ts |
79–116 | gatherAttestations — checks signature and key membership, but not the ±10-minute window |
src/xe.ts |
457–458 | renewLease computes renewTime from the SDK's own median |
src/xe.ts |
459–461 | the expiry precheck uses the SDK's renewTime ⇒ a renewal the node would accept is aborted |
src/xe.ts |
465 | #epochAt(renewTime) picks the epoch to lock ⇒ the locked params can be the wrong epoch's |
core/attestation.go |
47–49 | MaxAttestationSkew = 10 * time.Minute |
core/attestation.go |
91–93 | the node drops any attestation outside the window |
core/attestation.go |
100 | the node needs threshold survivors |
core/lease_renew.go |
52 | the node computes renewTime with ValidateAttestations — its own filter |
core/lease_renew.go |
95 | validateLockedEmissionAt(renewTime, b.LockedR, b.LockedCap, b.LockedTWAP, …) |
3. Reproduction
Deterministic — the node rule is transcribed verbatim and the SDK's own attestedTime is imported from the
built SDK.
// repro-attestation-skew.mjs
import { attestedTime } from './dist/attestation.js'
const MAX_SKEW = 10 * 60 * 1000
function nodeAttestedTime(atts, trusted, threshold, now) {
const seen = new Set(); const valid = []
for (const a of atts) {
if (!trusted.has(a.publicKey)) continue
if (seen.has(a.publicKey)) continue
if (Math.abs(a.timestamp - now) > MAX_SKEW) continue // the filter the SDK lacks
seen.add(a.publicKey); valid.push(a.timestamp)
}
if (valid.length < threshold) return { error: `only ${valid.length} valid attestations … need ${threshold}` }
valid.sort((a, b) => a - b)
return { time: valid[Math.floor((valid.length - 1) / 2)] }
}
const now = 1_700_000_000_000
const atts = [
{ publicKey: 'tk-a', timestamp: now },
{ publicKey: 'tk-b', timestamp: now + 3 * 60_000 },
{ publicKey: 'tk-c', timestamp: now + 15 * 60_000 }, // clock 15 min fast
]
console.log('node:', nodeAttestedTime(atts, trusted, 2, now).time)
console.log('sdk :', attestedTime(atts.map(a => ({ ...a, timestamp: BigInt(a.timestamp) }))).toString())
Observed:
attestations (ms since epoch):
tk-a t=1700000000000 skew=0.0 min node keeps it: true
tk-b t=1700000180000 skew=3.0 min node keeps it: true
tk-c t=1700000900000 skew=15.0 min node keeps it: false
node attested time : 1700000000000 (0 min from now)
SDK attested time : 1700000180000 (3 min from now)
DIVERGENCE : 3 min
With a lease whose effective expiry is 2 minutes away:
node renewTime < expiry? true -> the node WOULD accept the renewal
SDK renewTime < expiry? false -> the SDK throws "renewLease: lease expired at … before the renewal was attested"
=> the SDK ABORTS a renewal the node would have accepted. The lease is not renewed.
And with a threshold of 3 where two timekeepers have drifted:
SDK gatherAttestations() returns 3 attestations and reports the threshold MET (>= 3)
node ValidateAttestations() -> only 1 valid attestations from trusted timekeepers, need 3
=> the SDK hands the caller a block the node refuses to accept.
Full script: repro-attestation-skew.mjs. It imports the SDK's real attestedTime from the built SDK
(sdk/dist/attestation.js, built from 0dbc92ecff709bee79768e4e37788c682a0f4525) and is attached, together
with its output.
4. Impact
Two distinct consequences, both on the renewal path:
- The SDK aborts a renewal the node would accept. The SDK's median is pulled forward by the skewed
attestation, so
renewTimecan land at or pastlease.effectiveExpiryand the SDK throws "lease expired … before the renewal was attested". The lease is then not renewed and the machine is released at its current expiry — the same consequence class as the already-accepted SDK renewal report (XE-0077), reached through a different path. - The node rejects a renewal the SDK built. When enough attestations are outside the node's window, the
node's
ValidateAttestationsfinds fewer thanthresholdsurvivors and rejects the block with "only N valid attestations from trusted timekeepers, need M" — even though the SDK reported the threshold met and handed the caller a complete block. - The locked emission terms can come from the wrong epoch. The SDK locks the params of the epoch at its
renewal time; the node checks them against the epoch at its renewal time
(
validateLockedEmissionAt). When the two times straddle an epoch boundary and the params differ, the node rejects the block with "lease_renew locked emission mismatch".
Honest boundary — this has no effect on the live testnet today. The three public timekeepers' clocks are within ~3 seconds of each other (re-measured 2026-11-02 16:20 UTC from the HTTP
Dateheaders ofldn/nyc/ffm: 16:20:30 / 16:20:32 / 16:20:33), so no attestation falls outside the 10-minute window and the node drops none. And the per-epoch parameters are identical across the last 49 epochs — re-read live on 2026-11-02, epochs 4870–4918 all carryr_effective=2000,payout_cap=1527,twap_milli_usd=250, i.e. one distinct parameter set — so a divergence in renewal time cannot change the locked params either. The defect is live in the SDK's logic and becomes observable the first time a timekeeper's clock drifts more than 10 minutes — or when the epoch parameters start to differ. This is a latent defect, not a live incident, which is why it is filed as Minor.
5. Why the test suite misses it
The SDK's unit tests cover attestedTime as a pure median over a list, and gatherAttestations with mocked
timekeepers. There is no test in which an attestation is outside a skew window, because the SDK has no skew
window. The node's behaviour is therefore only discoverable by reading core/attestation.go against
src/attestation.ts.
6. Suggested fix
- Apply the node's filter in the SDK before computing the median: drop any attestation whose timestamp is more
than
MaxAttestationSkew(10 min) from the local clock, and count only the survivors against the threshold —gatherAttestationsshould report failure when fewer thanthresholdsurvive. - Keep the window in one exported constant so the SDK and the node cannot drift apart silently.
- Consider making the skew window configurable, since it is a node policy value (
MaxAttestationSkewis avar, not aconst, incore/attestation.go:49) that the core team can change. - Add a regression test: one attestation 15 minutes fast ⇒ the SDK's attested time equals the node's, and
gatherAttestationsfails when the surviving count drops below the threshold.
7. Duplicate check
xeprotocol/sdk: 0 issues, 14 PRs (fetched 2026-11-02). No PR or issue mentions attestation skew, the skew window, orattestedTime. PR #1 (the leasing feature) is the only PR that touches attestations.xeprotocol/xe: 236 issues + PRs, all fetched and searched 2026-11-02. The attestation-related entries are node-side and different: #19 / #23 (the sync path skips the freshness check — a node consensus issue, with a node PR open) and #175 / #176 (lease_accept locks terms from any of the last 4 epochs — the node's epoch-candidate tolerance). Neither touches the SDK's renewal-time computation.- XE bounty desk: all 113 published tickets searched 2026-11-02 — 0 hits for "skew"; the attestation hits
are XE-0010 (= upstream #19), XE-0030 (timekeeper attestation rate limit, node-side) and XE-0138
(
canAttestprovider identity, node-side).
8. Submission checklist (per programme "How to Report")
| Step | Requirement | Status |
|---|---|---|
| 1 | Reproduce against testnet; capture tx hashes / block heights | Reproduced locally and deterministically: the SDK's real attestedTime is compared with a verbatim transcription of ValidateAttestations. Not reproduced live — it needs a timekeeper whose clock is more than 10 minutes off, and the three public timekeepers are currently within ~3 s of each other (re-measured 2026-11-02). The live-state check is included as evidence that the defect is latent, not observed. The divergence is stated with that boundary rather than claimed as observed on the testnet. |
| 2 | GitHub issue with suggested severity tier and area | Tier: Minor · Area: SDK — compute leasing (renewal) |
| 3 | Clear PoC + impact analysis (who is affected, worst case) | Included — sections 3 and 4, with the live-state caveat stated up front |
| 4 | Critical/Severe goes to security@xe.network first |
Not applicable — Minor is below Severe, so a public issue is the correct channel |
| 5 | Triage by the core team | Awaiting |
| 6 | XE address for payout at genesis | 64e3ca3f6e9378cd549032de9f087b5496fd4100516c7bdb46c17b00d4220cd4 — XE native chain (block lattice, ed25519), derived from the reporter's recovery phrase via BIP39 → SLIP-0010 ed25519 m/44'/1'/account'; address = sha256("xe/account/v1" ‖ pubkey) |
Suggested tier: Minor (650 XE) — the SDK does not mirror the node's attestation acceptance rule; latent today, ends a renewal early when a timekeeper clock drifts
Thread
Thanks for the report and for stating clearly that this is latent on the current network. We have confirmed the parity gap you describe in the SDK's renewal path and it is being handled; we will update https://bounty.xe.network/XE-0254 when there is a fix to point at.