Bounty
XE-16982 · Bounty

[Low] Web UI trusts server-advertised PoW difficulty with no bound, timeout, or cancel

Closed · duplicate — xe#693 filed 2026-11-17 08:11 UTC by kecedanzz77-bit

Report

Summary

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

Root Cause

  • 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.
  • solvePow (:22-62) loops for (;;) with no deadline or AbortSignal (higher value = harder; default 0xfffff80000000000 ≈ 2²¹ hashes, max ≈ 2⁶⁴).
  • 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.

Verification

Executed PoC importing the real pow.js (node poc.mjs):

difficulty 0x1 (trivial)                : SOLVED in 4ms
difficulty 0xfffff80000000000 (default) : NOT SOLVED after 30000ms — loop still running, no timeout/cancel
difficulty 0xffffffff00000000 (~2^32)    : NOT SOLVED after 10000ms — loop still running, no timeout/cancel
difficulty 0xffffffffffffffff (max)     : NOT SOLVED after 10000ms — loop still running, no timeout/cancel

Even the default difficulty can pin the UI for 30s+; at/near max it never returns.

Note on related reports

Searched "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.

Suggested fix

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

Thread

Joseph Denneteam2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-16982 and says what differs; it is read like any other.