From 81d781a965d736e738bb780787a6d8c909da2501 Mon Sep 17 00:00:00 2001 From: selsta Date: Tue, 4 Aug 2026 00:48:13 +0200 Subject: [PATCH] wallet2: validate key image domain in reserve proofs Reported by zkao, a tool by zkSecurity (cherry picked from commit 1bb17925fdff1494ec8f7a127c9c6cd814c36e69) --- src/wallet/wallet2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 9449b8ad7..7c4a6d4c6 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -13446,6 +13446,8 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr { THROW_WALLET_EXCEPTION_IF(!seen_key_images.insert(proof.key_image).second, error::wallet_internal_error, "Duplicate key image in reserve proof"); THROW_WALLET_EXCEPTION_IF(!seen_outputs.emplace(proof.txid, proof.index_in_tx).second, error::wallet_internal_error, "Duplicate output in reserve proof"); + THROW_WALLET_EXCEPTION_IF(rct::ki2rct(proof.key_image) == rct::identity() || !rct::isInMainSubgroup(rct::ki2rct(proof.key_image)), + error::wallet_internal_error, "Invalid key image in reserve proof"); } THROW_WALLET_EXCEPTION_IF(subaddr_spendkeys.count(address.m_spend_public_key) == 0, error::wallet_internal_error,