What changed, and why it matters
This change lets a Monero wallet accept signed transaction files even when the file does not include the usual list of key images, as long as the wallet already knows those key images itself. It is a usability fix for stateless or offline signers, not a clear security bug fix. The patch adds checks to make sure the wallet really does know the key images before it proceeds, so it appears defensive rather than dangerous.
Review as a normal feature/robustness change. No urgent security action is indicated by the diff alone. If a security advisory exists, it was not supplied and should be obtained separately.
Security signals we found
New bounds check on transfer index before using local key image
New requirement that local key image is known and not partial
Continues to use existing sanity_check_pending_tx_set validation path
No removal of existing key-image validation when key_images is non-empty
Evidence from the diff
The commit modifies wallet2’s parsing of signed transaction blobs. Previously, parse_tx_from_str required signed_txs.key_images to be populated and used it to validate selected transfers. The patch allows signed_txs.key_images to be empty, in which case it falls back to the receiving wallet’s own m_transfers entries, verifying that the transfer index is in bounds and that the local key image is known and complete. A comment in the header is updated to document that key_images may be empty when the receiving wallet already knows the complete key images. This is a feature/enhancement to support stateless signers, with added bounds and completeness checks.
Changed components
src/wallet/wallet2.cpp parse_tx_from_strsrc/wallet/wallet2.h signed_tx structInspect captured patch +13 / −2
### src/wallet/wallet2.cpp
@@ -8501,15 +8501,25 @@ bool wallet2::parse_tx_from_str(const std::string &signed_tx_st, std::vector<too
{
// validate before mutating state or displaying to user
// - Verify with the assumption signed txs are redacted.
- // Manually check `signed_txs.key_images` so local state is not mutated before we validate.
+ // Manually check key images so local state is not mutated before we validate.
// We inject the key image checker because `ptx` internal sorting ambiguity makes it cumbersome to
// directly validate key images here.
// NOTE: These txs may be READ-ONLY, which means spent/frozen inputs are allowed.
const auto &kis = signed_txs.key_images;
this->sanity_check_pending_tx_set(signed_txs.ptx,
true,
false,
- { [&kis](const size_t i) {
+ { [this, &kis](const size_t i) {
+ if (kis.empty())
+ {
+ // Stateless signers may omit key images already synchronized with this wallet.
+ CHECK_AND_ASSERT_THROW_MES(i < m_transfers.size(), "failed loading signed tx: ptx selected transfer "
+ "is outside the bounds of wallet transfers");
+ const auto &td = m_transfers.at(i);
+ CHECK_AND_ASSERT_THROW_MES(td.m_key_image_known && !td.m_key_image_partial,
+ "failed loading signed tx: selected transfer key image is unknown or partial");
+ return td.m_key_image;
+ }
CHECK_AND_ASSERT_THROW_MES(i < kis.size(), "failed loading signed tx: ptx selected transfer "
"is outside the bounds of imported key images");
return kis.at(i);
### src/wallet/wallet2.h
@@ -508,6 +508,7 @@ namespace tools
{
std::vector<pending_tx> ptx;
// All key images in `m_transfers` from the signing wallet. Does not include key images in `ptx`.
+ // May be empty if the receiving wallet already knows the complete key images of all selected transfers.
std::vector<crypto::key_image> key_images;
// All key images in `ptx` for outputs being received by the wallet (e.g. change, churn).
std::unordered_map<crypto::public_key, crypto::key_image> tx_key_images;Why this scored 32/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.