{"id":"XE-0132","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"221","source_url":"https://github.com/xeprotocol/xe/issues/221","reporter_id":41,"title":"XE Network Vulnerability Report","area":null,"claimed_tier":"medium","assessed_tier":null,"verdict":"invalid","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"invalid","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-10-30T14:03:31.181609+00:00","updated_at":"2026-11-14T22:51:17.819874+00:00","source_created_at":"2026-10-30T14:02:17+00:00","told_at":"2026-11-14T22:49:31+00:00","status_changed_at":"2026-11-07T16:13:19.376764+00:00","url":"https://bounty.xe.network/XE-0132","body":"[future_timestamp_security_test.go.txt](https://github.com/user-attachments/files/34186283/future_timestamp_security_test.go.txt)\n[future_timestamp_test-output.log](https://github.com/user-attachments/files/34186284/future_timestamp_test-output.log)\n\n**Title:** Future-Dated Directory Registrations Bypass TTL Expiration  \n**Severity:** Medium (availability / stale-record persistence)  \n**Target:** `github.com/xeprotocol/xe`, commit `978785929bc17a2f4ab30c383e5fc9cf4d634512`  \n**Testing:** Local-only static analysis and unit-test reproduction. No public node or production system was contacted.\n\n## Summary\n\n`directory.VerifyRegistration` accepts any non-zero signed timestamp but does not reject timestamps in the future. `directory.Directory.Lookup`, `List`, and `Prune` calculate expiration as `now - reg.Timestamp`. For a future timestamp, this value is negative, so the registration is considered fresh until the future timestamp is reached and the TTL elapses.\n\nAn attacker who controls a valid account key can submit a signed registration with a timestamp far in the future. The record can then remain active in the directory for approximately the chosen future offset plus the configured TTL, overriding later registrations with ordinary timestamps because `Register` keeps the highest timestamp.\n\n## Affected Code\n\n- `directory/verify.go`: validates `Timestamp == 0` only; no future-skew limit.\n- `directory/directory.go:43-49`: accepts a registration when its timestamp is higher than the stored timestamp.\n- `directory/directory.go:61`, `directory/directory.go:81`, `directory/directory.go:95`: expiration uses `now - reg.Timestamp`, allowing negative age values.\n\n## Reproduction\n\nThe local test creates a valid signed registration with a timestamp 365 days in the future, registers it in a directory with a one-minute TTL, and immediately performs `Lookup`. The record is accepted and returned as valid.\n\nCommand:\n\n```powershell\npowershell.exe -NoProfile -Command 'Set-Location \"C:\\Users\\User\\xe-audit\"; & \"C:\\Users\\User\\local\\go\\bin\\go.exe\" test ./directory -run TestFutureDatedRegistrationNeverExpires -v -count=1'\n```\n\nObserved output:\n\n```text\n=== RUN   TestFutureDatedRegistrationNeverExpires\n    future_timestamp_security_test.go:28: future-dated registration remains valid: timestamp=1824904398773704700, now=1793368398774251600\n--- PASS: TestFutureDatedRegistrationNeverExpires (0.00s)\nPASS\nok      github.com/xeprotocol/xe/directory      1.004s\n```\n\nThe timestamp is approximately one year ahead of `now`, yet `Lookup` returns the registration as valid despite a one-minute TTL.\n\n## Impact\n\n- A valid account owner can pin a directory record far beyond the intended TTL.\n- A stale or malicious node endpoint can remain discoverable long after normal expiry.\n- Later normal-timestamp updates may be ignored because `Register` rejects timestamps lower than the stored future timestamp.\n- Service discovery can route traffic toward stale or attacker-controlled infrastructure.\n\nThe exact security impact depends on how directory records are consumed by discovery and connection code. This report does not claim unauthorized account impersonation: the registration remains signed by the account key. The confirmed issue is TTL bypass and stale-record pinning.\n\n## Recommended Fix\n\n1. Reject timestamps too far in the future, for example:\n\n```go\nif reg.Timestamp > time.Now().Add(MaxRegistrationClockSkew).UnixNano() {\n    return fmt.Errorf(\"timestamp too far in future\")\n}\n```\n\n2. Use a bounded clock-skew window, such as 5 minutes, based on network requirements.\n3. Treat future timestamps as invalid in `Lookup`, `List`, and `Prune` instead of treating negative age as fresh.\n4. Add regression tests for timestamps in the future and for replacement after expiry.\n\n## Evidence Files\n\n- `evidence/future_timestamp_security_test.go.txt`\n- `evidence/future_timestamp_test-output.log`\n\nNo live exploit, public-node probing, or destructive action was performed.\n","patch_refs":[{"id":228,"repo":"xeprotocol/xe","kind":"pr","ref":"193","title":"fix(directory): enforce timestamp freshness skew window and add operator removal (fixes #169)","url":"https://github.com/xeprotocol/xe/pull/193","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-10-30T14:46:55.778077+00:00"},{"id":234,"repo":"xeprotocol/xe","kind":"pr","ref":"233","title":"fix(directory): enforce timestamp freshness skew window and prevent future-dated TTL bypass (Fixes #221)","url":"https://github.com/xeprotocol/xe/pull/233","note":"","state":"open","author":"tipprb","added_by":"desk","created_at":"2026-10-31T10:43:27.721304+00:00"}],"thread":[{"id":78,"source":"github","source_ref":"6525590901","author":"arturbarszcz78","team":false,"body":"[comment from a blocked account removed]","created_at":"2026-10-30T14:46:55+00:00"},{"id":3239,"source":"github","source_ref":"6885436638","author":"XE desk","team":true,"body":"Thanks for the report. We read it against the code and could not confirm a bug in what it describes.\n\nThis report is closed as invalid. If we have missed something, file a new report that links\nhttps://bounty.xe.network/XE-0132 and says what; it is read like any other.","created_at":"2026-11-14T22:49:31+00:00"}]}