{"id":"XE-16982","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"693","source_url":"https://github.com/xeprotocol/xe/issues/693","reporter_id":2920,"title":"[Low] Web UI trusts server-advertised PoW difficulty with no bound, timeout, or cancel","area":"sdk-docs-web","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T08:13:52.000884+00:00","updated_at":"2026-11-22T23:26:11.403356+00:00","source_created_at":"2026-11-17T08:11:54+00:00","told_at":"2026-11-22T23:26:11.430309+00:00","status_changed_at":"2026-11-22T23:26:11.415995+00:00","url":"https://bounty.xe.network/XE-16982","body":"## Summary\n\nThe web UI trusts server-advertised PoW difficulty with no bound, timeout, or cancel. `getDifficulties()` takes `pow_difficulty`/`chat_pow_difficulty` straight from `GET /api/node`, `parseHexDifficulty` accepts any 1–16 hex chars (up to 2⁶⁴−1), and `solvePow` loops `for (;;)` with no deadline or AbortSignal. A compromised or misconfigured local node freezes both send flows (wallet send and chat send) until the tab is closed.\n\n## Root Cause\n\n- `web/assets/pow.js:71-94` `getDifficulties()` takes the difficulties from `GET /api/node` with no cap; `parseHexDifficulty` (`:91-94`) accepts any 1–16 hex chars.\n- `solvePow` (`:22-62`) loops `for (;;)` with no deadline or AbortSignal (higher value = harder; default `0xfffff80000000000` ≈ 2²¹ hashes, max ≈ 2⁶⁴).\n- Both callers await it unguarded: `xe-block.js:330-333` `computePow()` (wallet send; button disabled, shows 'signing + computing pow…', `wallet.js:839`) and `chat-envelope.js:43-44` `buildEnvelope()` (chat send; 'solving pow…', `chat.js:349`). No cancel control exists.\n\n## Verification\n\nExecuted PoC importing the real `pow.js` (`node poc.mjs`):\n\n```\ndifficulty 0x1 (trivial)                : SOLVED in 4ms\ndifficulty 0xfffff80000000000 (default) : NOT SOLVED after 30000ms — loop still running, no timeout/cancel\ndifficulty 0xffffffff00000000 (~2^32)    : NOT SOLVED after 10000ms — loop still running, no timeout/cancel\ndifficulty 0xffffffffffffffff (max)     : NOT SOLVED after 10000ms — loop still running, no timeout/cancel\n```\n\nEven the default difficulty can pin the UI for 30s+; at/near max it never returns.\n\n## Note on related reports\n\nSearched \"web wallet PoW difficulty unbounded\" (0 hits). Distinct from **#397** (Go CLI chat path only; #397 explicitly says the block-signing path is unaffected because the Go CLI uses constant `core.DefaultDifficulty` — the web UI does NOT use a constant). Threat model is weaker than #397's (UI proxies to the local node) → Low.\n\n## Suggested fix\n\nCap the accepted difficulty (e.g. reject anything above a sane maximum), add a timeout and a cancel control to `solvePow`, and surface a clear error when PoW does not complete in time.\n","patch_refs":[],"thread":[{"id":18793,"source":"desk","source_ref":"reply:16470","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-16982 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:11.403356+00:00"}]}