Files
ObsidianDragon/security-findings-gui-wallet.md
DanSandClaude Opus 4.8 6bb72f9878 fix(input): strip Unicode/CJK whitespace across address, key, and URL inputs
Follow-up to the key-import fix: an audit found the same ASCII-only-trim pattern
across the input layer, where a pasted value carrying CJK full-width (U+3000),
NBSP, zero-width, or BOM whitespace survived trimming and then failed validation
or an RPC. Most paths failed closed (same value validated and acted on → "won't
work" rather than a wrong send), but several mattered — above all the Lite
Import Key path, the exact recurrence of the reported bug on the Lite variant.

Single-token inputs (keys, addresses, URLs) now go through
util::stripAllWhitespaceForKey; path/label inputs use the new
util::trimUnicodeWhitespace (edge-trim, preserves internal spaces):

- Lite Import Key (settings_page) — strip-all before importKeyAsync. [fund recovery]
- Lite wallet path (open/restore) — edge-trim the request path AND the empty gate
  (they had diverged: gate trimmed, request used raw).
- Contacts — gate on and save the cleaned label/address; clean on paste; an
  address never persists with stray whitespace (which silently broke every later
  use + defeated duplicate detection).
- Send recipient — strip-all on paste and on field edit, so a CJK-pasted valid
  address validates and sends.
- Chat new-conversation z-address — validate and send the cleaned value.
- Chat restore-by-address — strip-all (the old trim even missed '\r'), so a
  padded address matches the deleted list instead of broadcasting a junk memo.
- Mining pool URL + payout — strip-all at persist and in the payout check.
- Validate-address dialog — strip-all before classify.
- Lite custom server URL — strip-all; its label edge-trimmed.
- Payment URI — strip-all the parsed address.
- Defense-in-depth: importPrivateKey / sweepPrivateKey strip-all the key;
  importWalletFile edge-trims the path.

Adds trimUnicodeWhitespace coverage to testKeyInputSanitization. Build + tests +
hygiene green. (Deferred, noted for follow-up: the console tokenizer treating
Unicode whitespace as a separator, and repairing already-polluted address-book
entries on load.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-15 12:11:54 -06:00

8.2 KiB

Security findings — ObsidianDragon & silentdragonxlite-cli

Source: external security report (Oct 2026), the same report whose daemon and lightwalletd findings have already been fixed and shipped. This file hands off the remaining findings, which live in the GUI wallet (ObsidianDragon) and the light-wallet CLI (silentdragonxlite-cli) — out of the dragonxd/lightwalletd scope. None of the items below are fixed yet.

Each finding lists the affected file(s), a short summary, impact, how far the reporter proved it, and a recommended fix. Line numbers are from the reporter's pinned trees (ObsidianDragon pin 854140d802ccc8dc; silentdragonxlite-cli tarball sha256 prefix 90496dce993cb969); confirm against current source before editing.


ObsidianDragon

F5 — Unsigned bootstrap archive overwrites the daemon config → RCE (High)

  • Where: src/util/bootstrap.cpp (the extract path — no signature check, no verifyChecksums call).
  • Summary: the bootstrap download is guarded only by a same-origin SHA256 checksum, which a MITM can recompute. A crafted archive can overwrite the daemon's DRAGONX.conf (a same-directory overwrite is not rejected — only ../ path traversal is), including a blocknotify= directive, which the daemon then runs on every new block.
  • Impact: remote code execution on the wallet host, given a MITM on the download (or CDN compromise) and a daemon restart. Reporter executed the full chain 5/5: crafted zip → conf overwritten → daemon ran blocknotify on every block (unique marker file per block hash).
  • Fix: verify a signature (ed25519 or similar, pinned public key) over the archive before extraction, rejecting anything that doesn't match. The checksum alone is insufficient — whoever can replace the archive can replace the checksum. (Also consider refusing to overwrite an existing DRAGONX.conf from a bootstrap at all.)

F8 — Pool payout gate accepts any 21-byte Base58Check address, including other chains (Medium)

  • Where: src/util/address_validation.cpp:151-156 (isTransparentAddress), src/app_network.cpp:2583-2591 (startPoolMining gate); the pasted string is stored unchanged as the mining user (app_network.cpp:2615 via mining_pool_panel.cpp:29) and handed to xmrig as the pool user field (xmrig_manager.cpp:213).
  • Summary: isTransparentAddress validates only the Base58Check checksum and the 21-byte payload length — not the DragonX version byte — and the pool-start path treats that as proof of a valid payout address. A Bitcoin mainnet P2PKH address passes (the code's own comment at address_validation.cpp:154-155 says the daemon is supposed to vet the version byte, which this path never does).
  • Impact: a user who pastes a foreign-chain address as their pool payout loses every reward credited to it — the coins go where the DragonX wallet can't spend them. Reporter proved the acceptance 5/5 (real isTransparentAddress returns true for BTC 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2; DragonX mainnet transparent addresses are version 60).
  • Fix: check the decoded version byte inside isTransparentAddress against DragonX's transparent prefixes (the same version bytes dragonxd's decoder uses), so the gate rejects foreign-chain addresses before xmrig starts, instead of deferring to the daemon.

F12 — Pool connection accepts any TLS certificate without a fingerprint (Medium)

  • Where: drg-xmrig src/base/net/stratum/Tls.cpp:186 (verifyFingerprint returns true when the fingerprint is null); ObsidianDragon src/xmrig_manager.cpp:209-217 (never sets a fingerprint); src/config/settings.h:688 (pool_tls_ defaults false).
  • Summary: when pool TLS is enabled but no fingerprint is configured, any certificate is accepted. The wallet never writes a fingerprint.
  • Impact: if the user enables pool TLS, a network attacker presenting any certificate receives the stratum login (the payout address) and can feed jobs. Requires the user to explicitly enable pool TLS. Source review only.
  • Fix: require a fingerprint when pool TLS is enabled, or set a pinned fingerprint from the pool's published certificate.

F13 — migrate-to-seed port scan misses bound-but-not-listening sockets (Medium)

  • Where: src/daemon/seed_wallet_creator.cpp:35-40 (pickFreePort), src/daemon/embedded_daemon.cpp:433-442 (tcpPortInUse checks LISTEN only).
  • Summary: the migrate-to-seed path scans ports 21770-21899 for LISTEN sockets only, so a local co-tenant who binds a non-listening socket in that range is invisible to the scan and gets picked.
  • Impact: a local unprivileged co-tenant can make the wallet choose a port they hold, then start a listener after the scan and intercept the isolated daemon's RPC (TOCTOU). Reporter proved the pick + banner-read 5/5 (the full RPC sweep was not executed).
  • Fix: hold the port with SO_REUSEADDR before the scan, or use a socketpair/pipe for the local IPC instead of a TCP port.

silentdragonxlite-cli

F9 — Wallet encryption key derived from the bare password, no salt or KDF (Medium)

  • Where: lib/src/lightwallet.rs:77-81 (double_sha256) and :923-934 (secretbox key); same derivation in lib/src/lightclient.rs:576. Password/seed flags: cli/src/lib.rs:28-37, read in cli/src/main.rs:19,28.
  • Summary: the secretbox key is SHA256(SHA256(password)) with no salt. The random nonce is stored beside the ciphertext and does not slow a guess, so a stolen wallet file is an offline guess at SHA-256 speed; the same password always yields the same key.
  • Impact: local only — whoever can read the wallet file and guesses the password recovers the spending key. A strong password holds; a weak one does not. Remote attackers get nothing from this alone. Inherited silentdragon/zecwallet-light lineage. Source review only.
  • Fix: derive the key with a memory-hard KDF (argon2id or scrypt) over the password plus a random salt stored beside the wallet, and read the seed/password from a prompt or stdin instead of argv.

F10 — TLS verification disabled for the t-address scan and the mempool monitor (Medium)

  • Where: lib/src/lightclient.rs:1533 (scan_taddress_txids) and :1171 (mempool monitor), via lib/src/grpcconnector.rs:47-49, 26-31. Default server https://lite.dragonx.is (lightclient.rs:45).
  • Summary: two RPC call sites hardcode no_cert = true, so certificate verification is off for the transparent-address history scan and the mempool monitor, even though the compact-block fetch path honors the configured flag.
  • Impact: an on-path attacker presenting any certificate captures the wallet's transparent addresses and the server's txid list during a normal sync, and feeds raw mempool bytes with no cert check. No spending key is in either request; the loss is the address list plus the integrity of transparent history and mempool data. Source review only.
  • Fix: replace the hardcoded true at both call sites with the configured no_cert_verification value.

F11 — Encrypting the wallet leaves the plaintext seed on disk as a .bak (Medium)

  • Where: lib/src/lightclient.rs:744-745 and :472-475.
  • Summary: after encrypting, the first save copies the still-plaintext wallet to a .bak backup before renaming the encrypted version, leaving the unencrypted seed on disk.
  • Impact: local only — whoever can read the wallet directory recovers the plaintext seed from the .bak. Source review only.
  • Fix: delete the .bak after a successful encrypted save.

Already handled elsewhere (for context)

These report findings are out of this doc's scope — they were fixed/triaged in the daemon and light-server repos:

  • dragonxd (origin/dev / origin/master): F1 reorg-shutdown DoS, F14 header-flood cap, F15 miner cs_main, F16 CRYPTO555/notary t-vout (default-off consensus gate). F17 (coinbase maturity) was investigated and refuted — mainnet maturity is already 100 (> the 99-block reorg limit).
  • lightwalletd (origin/master): F2/F3/F4 gRPC hardening, F6 GetAddressTxids nil Range, F7 GetTransaction empty TxFilter crash.