Sign and Verify replace non-breaking spaces in the message #1091

Open
opened 2026-11-09 11:29:38 +00:00 by jarolrod · 0 comments
jarolrod commented 2026-11-09 11:29:38 +00:00 (Migrated from github.com)

Pasting a message containing a non-breaking space changes the text supplied to signing and verification. A valid signature for the original message fails verification, and signing the pasted message creates a signature for different bytes.

To reproduce:

  1. Use a wallet-owned legacy P2PKH address and the message Audit statement, with U+00A0 NON-BREAKING SPACE between the words. In escaped notation, the message is Audit\u00a0statement; use the actual character rather than the literal escape.
  2. Generate a signature for that exact message using Core’s signmessage RPC. Confirm that verifymessage accepts it.
  3. Open Wallet settings → Sign or verify message → Verify. Enter the address, paste the original message and its signature, then click Verify.
  4. Clear the form, switch to Sign, paste the same original message and sign it. Check the resulting signature with Core against both the original message and Audit statement with an ordinary space.

The GUI reports “Message verification failed” in step 3. In step 4, its signature verifies against the ordinary-space version and fails against the original. The text supplied to signing and verification contains U+0020 where the pasted message contained U+00A0.

For this example, the UTF-8 bytes change from 4175646974c2a073746174656d656e74 to 41756469742073746174656d656e74. Ordinary-space messages and controls containing other Unicode characters, tabs, newlines and trailing spaces work correctly.

Sign/Verify should preserve the exact message being signed or verified. The current submission code reads the editor’s .text property. Qt’s plain-text conversion documents this space substitution, and the Widgets dialog also uses toPlainText(). The failure concerns the application’s handling of exact message content; the underlying signing operation processes the bytes it receives correctly.

Reproduced on merged 6e54a48ab571, macOS / Qt 6.9, using the full offscreen application, the editor’s public paste() method and independent Core RPC checks. Native Command-V/Cocoa clipboard integration was not tested.

Pasting a message containing a non-breaking space changes the text supplied to signing and verification. A valid signature for the original message fails verification, and signing the pasted message creates a signature for different bytes. To reproduce: 1. Use a wallet-owned legacy P2PKH address and the message `Audit statement`, with U+00A0 NON-BREAKING SPACE between the words. In escaped notation, the message is `Audit\u00a0statement`; use the actual character rather than the literal escape. 2. Generate a signature for that exact message using Core’s `signmessage` RPC. Confirm that `verifymessage` accepts it. 3. Open Wallet settings → Sign or verify message → Verify. Enter the address, paste the original message and its signature, then click Verify. 4. Clear the form, switch to Sign, paste the same original message and sign it. Check the resulting signature with Core against both the original message and `Audit statement` with an ordinary space. The GUI reports “Message verification failed” in step 3. In step 4, its signature verifies against the ordinary-space version and fails against the original. The text supplied to signing and verification contains U+0020 where the pasted message contained U+00A0. For this example, the UTF-8 bytes change from `4175646974c2a073746174656d656e74` to `41756469742073746174656d656e74`. Ordinary-space messages and controls containing other Unicode characters, tabs, newlines and trailing spaces work correctly. Sign/Verify should preserve the exact message being signed or verified. The current [submission code](https://github.com/bitcoin-core/gui-qml/blob/6e54a48ab571cb46b813eb1d98a301401089192f/qml/pages/wallet/SignVerifyMessage.qml#L66) reads the editor’s `.text` property. Qt’s plain-text conversion documents this space substitution, and the Widgets dialog also uses `toPlainText()`. The failure concerns the application’s handling of exact message content; the underlying signing operation processes the bytes it receives correctly. Reproduced on merged `6e54a48ab571`, macOS / Qt 6.9, using the full offscreen application, the editor’s public `paste()` method and independent Core RPC checks. Native Command-V/Cocoa clipboard integration was not tested.
Sign in to join this conversation.
No description provided.