What changed, and why it matters
This commit adds a guard in Monero's wallet software that rejects reserve proof messages containing a NUL (zero) byte. Reserve proofs are cryptographic receipts that prove a wallet controls certain funds. The change prevents messages with embedded NUL bytes from being used, likely to avoid ambiguity or manipulation when the message is later parsed, displayed, or signed. The exact attack is not described in the commit, but NUL-byte injection is a common source of parsing and verification bugs.
Treat as a low-to-moderate hardening fix. Review how reserve proof messages are parsed and verified elsewhere to ensure NUL-byte handling is consistent. If this fix was prompted by a reported bug, obtain the associated issue or advisory for full impact assessment.
Security signals we found
Input validation hardening: explicit rejection of NUL bytes in a signed message field
Potential parsing/verification boundary issue: NUL bytes can truncate or confuse C-style string handling in proof verification or display
Defensive patch in a cryptographic proof API
Evidence from the diff
In src/wallet/wallet2.cpp, get_reserve_proof() now throws a wallet_internal_error if the supplied message string contains ‘\0’. The function generates a reserve proof (a signature over selected outputs plus the message). Adding this check prevents embedded NUL bytes from reaching the proof construction or any downstream code that may treat NUL as a string terminator. The patch is one line and defensive; it does not show the specific vulnerability being fixed, only the hardening measure.
Changed components
src/wallet/wallet2.cppwallet2::get_reserve_proof()Monero reserve proof generationInspect captured patch +1 / −0
### src/wallet/wallet2.cpp
@@ -13114,6 +13114,7 @@ bool wallet2::check_tx_proof(const cryptonote::transaction &tx, const cryptonote
std::string wallet2::get_reserve_proof(const boost::optional<std::pair<uint32_t, uint64_t>> &account_minreserve, const std::string &message)
{
THROW_WALLET_EXCEPTION_IF(m_watch_only || m_multisig, error::wallet_internal_error, "Reserve proof can only be generated by a full wallet");
+ THROW_WALLET_EXCEPTION_IF(message.find('\0') != std::string::npos, error::wallet_internal_error, "Reserve proof message must not contain NUL bytes");
// determine which outputs to include in the proof
// is_spent(td, false) excludes an output already used as input to a pending, unconfirmedWhy this scored 37/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.