SpendProofV1 txid-substitution: get_spend_proof/check_spend_proof do not verify returned transaction hash
The wallet's spend-proof helpers build the challenge from the caller-supplied txid but never check that the transaction blob returned by the daemon actually hashes to that txid. A malicious or on-path daemon can answer a request for one txid with a different valid transaction, so the wallet signs or verifies a proof for the wrong id.
- Triaged in 7 hours
- Fixed in 2 months
- Disclosed after 3 months
Repository: monero-project/monero — src/wallet/wallet2.cpp. Snapshot: master @ 3ad4a5ee8 (v0.18.1.0-3ad4a5ee8).
Summary
Both helpers fetch a pruned transaction with /gettransactions, parse it with get_pruned_tx(), then build the spend-proof challenge from the txid argument, not from the hash implied by the blob. Neither compares tx_hash (from parsing) to txid before signing or verifying. check_tx_proof() on the same RPC path does that comparison.
get_spend_proof (roughly wallet2.cpp 11868–11969): request, parse, then:
std::string sig_prefix_data((const char*)&txid, sizeof(crypto::hash));
sig_prefix_data += message;
crypto::hash sig_prefix_hash;
crypto::cn_fast_hash(sig_prefix_data.data(), sig_prefix_data.size(), sig_prefix_hash);
// ring sigs use tx / rings from res.txs[0], not a second hash check
check_spend_proof (same file, ~11979–12084) repeats the pattern: prefix hash from txid, ring checks from the parsed tx.
For comparison, after get_pruned_tx in check_tx_proof:
THROW_WALLET_EXCEPTION_IF(tx_hash != txid, error::wallet_internal_error,
"Failed to get the right transaction from daemon");
So if the HTTP peer in front of the wallet is malicious (fake monerod, corporate proxy, or on-path MITM), it can answer a request for txid B with a valid serialized body for a different tx A. The wallet still signs H(B || message) while using inputs/key images/rings from A. Verifiers that use check_spend_proof against the same bad endpoint will see good: true for B even though nothing in the response actually authenticates B.
This is integrity of the spend proof binding, not key exfiltration or remote wallet compromise. You still need a broken or attacker-controlled daemon channel.
Releases Affected
Re-checked on master @ 3ad4a5ee8. The missing tx_hash == txid guard is plain in source; any branch with this spend-proof code path behaves the same unless someone already merged an equivalent check.
Steps to Reproduce
The practical check is end-to-end: real monerod --regtest, real monero-wallet-rpc, and a tiny Python reverse proxy that forwards to the honest node but, on POST /gettransactions, replaces a chosen FAKE txs_hashes entry with the REAL hash of a spend the wallet actually made. The node returns a consistent pruned tx for A; the RPC still asks for a proof on FAKE. No Monero source edits.
One command (paths match this machine; adjust MONERO_BUILD if your tree lives elsewhere):
bash /home/beni/Monero/reports/poc_spend_proof_txid_substitution.sh
The script mirrors what you would do by hand: mine and transfer on a direct daemon URL (so sync is boring), record the real spend txid, bring up the MITM, set_daemon to it with "ssl_support":"disabled" for plain HTTP, then call get_spend_proof with the random FAKE id, check_spend_proof with the returned signature, and finally point back at the honest daemon to show the same FAKE id no longer yields a proof.

What you should see in the log: SpendProofV1… returned for FAKE, check_spend_proof reports good, then after dropping the MITM the wallet errors on get_spend_proof for FAKE (e.g. missing / wrong txs count).
Build the binaries once from the official tree, Release, no patches — same idea as the other lab scripts in reports/.
If you hate shell wrappers, the two attachments that matter are:
reports/poc_spend_proof_txid_substitution.shreports/poc_spend_proof_txid_substitution_proxy.py
Possible Solution
After get_pruned_tx(res.txs[0], tx, tx_hash) succeeds in both get_spend_proof and check_spend_proof, add the same guard as check_tx_proof:
THROW_WALLET_EXCEPTION_IF(tx_hash != txid, error::wallet_internal_error,
"Failed to get the right transaction from daemon");
Add a regression test (daemon fixture or mocked HTTP) that returns a blob whose id does not match the requested hash; both entry points should bail before signing or verifying.
Impact
A malicious, compromised, or MITM daemon can break the integrity binding of SpendProofV1.
get_spend_proof and check_spend_proof are supposed to operate on the transaction identified by the caller-supplied txid. However, because the parsed transaction hash is not compared against that txid, the daemon can return transaction body A for a request for txid B. The wallet then builds/verifies the spend-proof challenge over B while using the inputs, key images, and rings from A.
In the PoC, a random FAKE txid cannot produce a spend proof against the honest daemon. When /gettransactions is MITM-substituted with a real wallet-originated transaction body, get_spend_proof(txid=FAKE) succeeds and check_spend_proof(txid=FAKE, signature=...) returns good:true behind the same malicious daemon.
This can mislead services or automation that rely on check_spend_proof as evidence that a user created/spent a specific transaction id, if their wallet-rpc verifier is connected to an attacker-controlled, compromised, or MITM'd daemon.
This is not a private-key leak, fund theft, consensus issue, or RCE. The precondition is control of the wallet-to-daemon response path. The impact is proof authenticity/integrity failure.
Note
Drafting and the PoC wiring had editor/AI help; line numbers, script runs, and daemon behaviour were checked against the local tree/build.
Bounty
If this qualifies for a bounty, XMR can be sent to:
47TUANy82gtBFMvsFwyA3hE98PzgKSmxNia3n9fpvSadDWs234M7oWfevXqYxKmy3d9hSp1TH82gX4JWvNEUupse2s92maV
Context
Monero's wallet code exposes two helpers for spend proofs, get_spend_proof and check_spend_proof, in src/wallet/wallet2.cpp of the monero-project/monero repository. A spend proof is a signature that ties a transaction to a message: the wallet builds a challenge from the transaction id and the message, then signs it with ring signatures over the inputs, key images and rings of that transaction. A verifier later rebuilds the same challenge and checks the signature, so a service can treat a valid proof as evidence that a given transaction id was created or spent by the holder of the wallet.
The report was checked against a snapshot of master @ 3ad4a5ee8, described as v0.18.1.0-3ad4a5ee8.
Setup
The proof of concept uses no Monero source edits. It runs a real monerod --regtest, a real monero-wallet-rpc, and a small Python reverse proxy that forwards to the honest node. The proxy intercepts POST /gettransactions and replaces a chosen FAKE txs_hashes entry with the REAL hash of a spend the wallet actually made. The node then returns a consistent pruned transaction for that real spend, while the RPC layer still believes it is answering a request for the FAKE id.
The binaries are built once from the official tree, Release, no patches. The wallet is pointed at the proxy with set_daemon and "ssl_support":"disabled" so plain HTTP is used. The two attachments that matter are:
reports/poc_spend_proof_txid_substitution.shreports/poc_spend_proof_txid_substitution_proxy.py
The precondition for the whole issue is control of the wallet-to-daemon response path: a fake monerod, a corporate proxy, or an on-path MITM.
Finding it
Both helpers fetch a pruned transaction with /gettransactions, parse it with get_pruned_tx(), and then build the spend-proof challenge from the txid argument rather than from the hash implied by the returned blob. Neither compares tx_hash (from parsing) to txid before signing or verifying. The same RPC path in check_tx_proof() does perform that comparison, which makes the omission stand out.
In get_spend_proof (roughly wallet2.cpp 11868-11969), after the request and parse, the code is:
std::string sig_prefix_data((const char*)&txid, sizeof(crypto::hash));
sig_prefix_data += message;
crypto::hash sig_prefix_hash;
crypto::cn_fast_hash(sig_prefix_data.data(), sig_prefix_data.size(), sig_prefix_hash);
// ring sigs use tx / rings from res.txs[0], not a second hash check
check_spend_proof (same file, roughly 11979-12084) repeats the pattern: the prefix hash comes from txid, while the ring checks come from the parsed tx.
For comparison, check_tx_proof does this after get_pruned_tx:
THROW_WALLET_EXCEPTION_IF(tx_hash != txid, error::wallet_internal_error,
"Failed to get the right transaction from daemon");
That guard is exactly what the spend-proof helpers lack.
Exploitation
Step 1: mine and transfer against the honest daemon
The script first mines and performs a transfer on a direct daemon URL, so synchronisation is straightforward, and records the real spend txid. This gives the proxy a genuine transaction body to substitute later.
Step 2: start the MITM proxy and point the wallet at it
The proxy is brought up in front of the honest node. The wallet is then switched to it with set_daemon, using "ssl_support":"disabled" for plain HTTP. From this point the wallet's /gettransactions requests pass through the attacker-controlled component.
Step 3: request a proof for a random FAKE txid
The wallet calls get_spend_proof with a random FAKE id. On POST /gettransactions, the proxy replaces the FAKE txs_hashes entry with the REAL hash of the spend made in step 1. The node returns a consistent pruned transaction for the real spend, but the wallet still builds the challenge from the FAKE id it was asked about. It signs H(B || message) while using the inputs, key images and rings from transaction A.
Step 4: verify the returned signature
The wallet calls check_spend_proof with the returned signature. Behind the same malicious daemon, the verifier sees good: true for the FAKE id, even though nothing in the response actually authenticates that id.
Step 5: drop the MITM and retry
Finally the wallet is pointed back at the honest daemon. The same FAKE id no longer yields a proof: the wallet errors on get_spend_proof for FAKE, for example because of a missing or wrong txs count. This shows that the same FAKE id no longer yields a proof against the honest daemon.
The whole sequence can be run with one command (paths match the researcher's machine; adjust MONERO_BUILD if the tree lives elsewhere):
bash /home/beni/Monero/reports/poc_spend_proof_txid_substitution.sh
The script mirrors the manual steps: mine and transfer on a direct daemon URL, record the real spend txid, bring up the MITM, set_daemon to it with "ssl_support":"disabled" for plain HTTP, call get_spend_proof with the random FAKE id, call check_spend_proof with the returned signature, and point back at the honest daemon to show the same FAKE id no longer yields a proof.

The screenshot shows the run of the script. In the log you should see SpendProofV1… returned for FAKE, check_spend_proof reporting good, and then, after dropping the MITM, the wallet erroring on get_spend_proof for FAKE (for example a missing or wrong txs count).
Root cause
The spend-proof challenge is derived from the caller-supplied txid, but the transaction body used for the ring signature checks comes from whatever the daemon returned. Because the parsed tx_hash is never compared with txid, a malicious or compromised daemon can answer a request for txid B with a valid serialised body for a different transaction A. The wallet signs or verifies over B while using the inputs, key images and rings from A.
The existing defence on the neighbouring code path is the tx_hash != txid guard in check_tx_proof. It was simply not applied to get_spend_proof and check_spend_proof. The report notes that the missing guard is plain in the source and that any branch with this spend-proof code path behaves the same unless someone has already merged an equivalent check.
Impact
A malicious, compromised or MITM daemon can break the integrity binding of SpendProofV1. In the PoC, a random FAKE txid cannot produce a spend proof against the honest daemon, but when /gettransactions is substituted with a real wallet-originated transaction body, get_spend_proof(txid=FAKE) succeeds and check_spend_proof(txid=FAKE, signature=...) returns good: true behind the same malicious daemon.
This can mislead services or automation that rely on check_spend_proof as evidence that a user created or spent a specific transaction id, if their wallet-rpc verifier is connected to an attacker-controlled, compromised or MITM'd daemon.
The report is explicit about the limits: this is not a private-key leak, fund theft, consensus issue or RCE. The precondition is control of the wallet-to-daemon response path, and the impact is proof authenticity and integrity failure.
Fix
After get_pruned_tx(res.txs[0], tx, tx_hash) succeeds in both get_spend_proof and check_spend_proof, add the same guard used by check_tx_proof:
THROW_WALLET_EXCEPTION_IF(tx_hash != txid, error::wallet_internal_error,
"Failed to get the right transaction from daemon");
A regression test should also be added, using a daemon fixture or mocked HTTP, that returns a blob whose id does not match the requested hash. Both entry points should bail before signing or verifying.
- Other proof helpers on the same RPC path. Look for functions that fetch a transaction and then build a challenge from a caller-supplied id. A positive result is a helper that signs or verifies successfully when the daemon returns a body for a different transaction.
- Compare against guarded siblings. Where one function in a file performs a
tx_hash != txidcheck and a neighbouring function does not, test the unguarded one with a substituted/gettransactionsresponse. A positive result is a proof that verifies for an id the daemon never actually returned. - Proxy substitution on
POST /gettransactions. Replace a requestedtxs_hashesentry with the hash of a real transaction and see whether the client accepts the body. A positive result is a client that proceeds without noticing the mismatch. - Honest-daemon control run. Repeat the same request without the proxy. A positive result for the vulnerability is the honest daemon refusing to produce a proof for the fake id, which confirms the earlier success depended on the substitution.
- Regression test with a mismatched blob. Feed both entry points a blob whose id differs from the requested hash. A positive result is both functions throwing before any signing or verification takes place.
What happened, in plain words
Monero is a cryptocurrency: a digital money system where transactions are recorded on a shared public ledger instead of in a bank's database. People run software called a wallet to hold and spend it, and that wallet talks over the internet to another piece of software called a node (the program monerod), which keeps a copy of the ledger and answers questions about it.
One feature of the Monero wallet is the spend proof. It is a small cryptographic signature that says: "the person who controls this wallet really did create or spend the transaction with this particular identifier." A shop, an exchange or an automated service can ask the wallet for such a proof and then check it, without needing to trust the person. The identifier of a transaction is called its txid, short for transaction id: a long string of characters that uniquely names one transaction on the ledger.
The researcher found that two functions in the wallet code, get_spend_proof (make a proof) and check_spend_proof (check a proof), never confirm that the transaction the node sent back is actually the transaction that was asked about. If an attacker can sit between the wallet and the node and swap one transaction for another, the wallet will happily produce a proof for the wrong identifier, and the checker will happily say it is valid.
This is not a way to steal coins or steal private keys. It is a way to make a proof say something that is not true, and only if the attacker already controls the connection between the wallet and the node.
Some background before the details
A few ideas come up again and again below, so here they are from zero.
- API: an API (application programming interface) is the agreed set of requests one program can send to another. Think of a restaurant menu: you can only order the dishes listed, in the wording listed, and the kitchen answers in a known format. The wallet and the node talk through such a menu of requests.
- RPC: remote procedure call, a style of API where one program asks another to run a named function, usually over HTTP.
monero-wallet-rpcis a program that exposes the wallet's functions this way, so other software can ask the wallet to do things. - HTTP request: the message a browser or program sends to a server, for example
POST /gettransactions.POSTmeans "here is some data, please act on it", and/gettransactionsis the address (path) of the function being called. - Transaction: a record saying coins moved from one place to another. On Monero it is stored as a blob, a chunk of binary data, and it has a txid.
- Pruned transaction: a transaction stored without some of its bulky optional data, enough to check it but smaller to send. The wallet asks for pruned transactions to save bandwidth.
- Hash: a mathematical fingerprint of some data. Feed in any data and you get back a fixed-length string; change one byte of the input and the fingerprint changes completely. It is used to name things (a txid is a hash of the transaction) and to build challenges for signatures.
- Signature: a cryptographic stamp proving that the holder of a secret key approved some exact piece of data. Change the data and the signature no longer checks out.
- Ring signature: Monero's special kind of signature that hides which of several possible spenders actually signed. It uses the inputs (the coins being spent), the key images (one-time markers that stop the same coin being spent twice) and the rings (the groups of possible signers) of a transaction.
- Challenge: the exact data a signature is made over. If two programs build the challenge differently, the signature will not match.
- MITM: man in the middle. An attacker who sits on the network path between two parties, relaying their messages but able to read or alter them. A malicious Wi-Fi hotspot or a compromised corporate proxy is a typical example.
- Reverse proxy: a small program that stands in front of a real server and forwards requests to it, optionally changing them on the way. Here it is used to play the role of the attacker.
- Integrity: the property that data has not been altered. An integrity failure means someone changed data and the system did not notice.
- Regression test: an automated test added so that a bug, once fixed, cannot quietly come back later.
Context: what the feature is meant to do
The code lives in the monero-project/monero repository, in the file src/wallet/wallet2.cpp. A repository is the shared folder where a project's source code is kept. The researcher checked a snapshot of the code named master @ 3ad4a5ee8, described as v0.18.1.0-3ad4a5ee8; master is the main development line and the long string identifies one exact point in its history.
A spend proof works like this. The wallet takes the transaction id and a message, glues them together into a challenge, and signs that challenge using the ring signature data of the transaction. Later, a verifier rebuilds the same challenge from the same transaction id and message and checks the signature. If it matches, the service treats the proof as evidence that this transaction id was created or spent by the holder of the wallet.
The whole security of that reasoning rests on one assumption: the transaction data used to build and check the signature really belongs to the transaction id in the challenge. The finding is that the code never checks this.
Setup: how the demonstration was built
The proof of concept changes no Monero source code. It runs three things:
- A real
monerod --regtest. The--regtestflag puts the node in a private test mode where coins can be mined instantly and nothing touches the real Monero network, so experiments are free and fast. - A real
monero-wallet-rpc, the program that offers the wallet's functions over HTTP. - A small Python reverse proxy that forwards requests to the honest node but rewrites one of them on the way.
The proxy watches for POST /gettransactions, the request the wallet uses to fetch transactions by their ids. Inside that request is a list called txs_hashes, the ids being asked for. The proxy replaces a chosen FAKE id in that list with the REAL hash of a spend the wallet actually made earlier. The honest node then answers with a perfectly consistent transaction for that real spend, while the wallet believes it is receiving the transaction for the FAKE id.
The binaries (the compiled programs) are built once from the official source tree, in Release mode (an optimised build), with no patches. The wallet is then pointed at the proxy with a command called set_daemon, using "ssl_support":"disabled" so that plain, unencrypted HTTP is used.
The two files that matter are:
reports/poc_spend_proof_txid_substitution.shreports/poc_spend_proof_txid_substitution_proxy.py
The first is a shell script, a list of commands run in order; the second is the proxy itself. The precondition for the whole issue is control of the wallet-to-daemon response path: a fake monerod, a corporate proxy, or an on-path MITM. Without that position, none of this is possible.
Finding it: the missing check
Both helpers fetch a pruned transaction with /gettransactions, parse it with a function called get_pruned_tx(), and then build the spend-proof challenge from the txid argument, that is, from the id the caller asked about, not from the hash implied by the data the node returned. Neither compares tx_hash (the hash computed while parsing the returned data) with txid before signing or verifying.
The same RPC path in check_tx_proof() does perform that comparison. check_tx_proof is a sibling feature that proves something about a transaction, and it contains the guard the spend-proof helpers lack. Seeing one function check and its neighbour not check is what makes the omission stand out.
In get_spend_proof (roughly lines 11868 to 11969 of wallet2.cpp), after the request and the parse, the code is:
std::string sig_prefix_data((const char*)&txid, sizeof(crypto::hash));
sig_prefix_data += message;
crypto::hash sig_prefix_hash;
crypto::cn_fast_hash(sig_prefix_data.data(), sig_prefix_data.size(), sig_prefix_hash);
// ring sigs use tx / rings from res.txs[0], not a second hash check
Line by line:
std::string sig_prefix_data((const char*)&txid, sizeof(crypto::hash));creates a text buffer and fills it with the raw bytes oftxid, the id the caller asked about. This is the start of the challenge.sig_prefix_data += message;appends the message the caller wants tied to the proof. Now the buffer holds the requested id followed by the message.crypto::hash sig_prefix_hash;declares a variable to hold a hash.crypto::cn_fast_hash(sig_prefix_data.data(), sig_prefix_data.size(), sig_prefix_hash);computes the fingerprint of that buffer and stores it. This fingerprint is the challenge that will be signed.- The comment says the rest: the ring signature work uses
txand its rings taken fromres.txs[0], the first transaction in the node's response, and there is no second hash check. In other words, the challenge comes from the requested id, but the cryptographic material comes from whatever the node sent.
check_spend_proof (same file, roughly lines 11979 to 12084) repeats the pattern: the prefix hash comes from txid, while the ring checks come from the parsed tx.
For comparison, check_tx_proof does this after get_pruned_tx:
THROW_WALLET_EXCEPTION_IF(tx_hash != txid, error::wallet_internal_error,
"Failed to get the right transaction from daemon");
Line by line:
THROW_WALLET_EXCEPTION_IF(...)is a macro, a shorthand that expands to "if the condition inside is true, stop everything and raise an error".tx_hash != txidis the condition: the hash computed from the returned data is not equal to the id that was requested.error::wallet_internal_errornames the kind of error to raise."Failed to get the right transaction from daemon"is the human-readable message attached to it.
So check_tx_proof refuses to continue when the node answers with the wrong transaction. That guard is exactly what the spend-proof helpers lack.
Exploitation: the five steps
Step 1: mine and transfer against the honest daemon
The script first mines some coins and performs a transfer (a payment) on a direct daemon URL, meaning the wallet talks straight to the honest node with nothing in between. Doing this first keeps synchronisation straightforward, because the wallet and node see each other without interference. The script records the real spend txid. This gives the proxy a genuine transaction body to substitute later.
Step 2: start the MITM proxy and point the wallet at it
The proxy is brought up in front of the honest node. The wallet is then switched to it with set_daemon, using "ssl_support":"disabled" for plain HTTP. From this point on, every /gettransactions request the wallet makes passes through the attacker-controlled component. From this point on, every /gettransactions request the wallet makes passes through the proxy.
Step 3: request a proof for a random FAKE txid
The wallet calls get_spend_proof with a random FAKE id, one that does not exist on the ledger. On POST /gettransactions, the proxy replaces the FAKE txs_hashes entry with the REAL hash of the spend made in step 1. The node returns a consistent pruned transaction for the real spend, but the wallet still builds the challenge from the FAKE id it was asked about. It signs H(B || message) while using the inputs, key images and rings from transaction A. In plain words: the signature is made over the fake name, but with the cryptographic material of a different, real transaction.
Step 4: verify the returned signature
The wallet calls check_spend_proof with the returned signature. Behind the same malicious daemon, the verifier sees good: true for the FAKE id, even though nothing in the response actually authenticates that id. The checker rebuilds the challenge from the FAKE id, gets the same substituted transaction data, and the signature matches, so it reports success.
Step 5: drop the MITM and retry
Finally the wallet is pointed back at the honest daemon. The same FAKE id no longer yields a proof: the wallet errors on get_spend_proof for FAKE, for example because of a missing or wrong txs count. The wallet errors on get_spend_proof for FAKE, for example because of a missing or wrong txs count. This shows that the same FAKE id no longer yields a proof against the honest daemon.
The whole sequence can be run with one command (the paths match the researcher's machine; adjust MONERO_BUILD if the source tree lives elsewhere):
bash /home/beni/Monero/reports/poc_spend_proof_txid_substitution.sh
Line by line:
bashis the program that runs shell scripts./home/beni/Monero/reports/poc_spend_proof_txid_substitution.shis the full path to the script on the researcher's computer. On another machine the folder part would differ.
The script mirrors the manual steps: mine and transfer on a direct daemon URL, record the real spend txid, bring up the MITM, set_daemon to it with "ssl_support":"disabled" for plain HTTP, call get_spend_proof with the random FAKE id, call check_spend_proof with the returned signature, and point back at the honest daemon to show the same FAKE id no longer yields a proof.

The screenshot shows the run of the script. In the log you should see SpendProofV1… returned for FAKE, check_spend_proof reporting good, and then, after dropping the MITM, the wallet erroring on get_spend_proof for FAKE (for example a missing or wrong txs count). SpendProofV1 is simply the text prefix that marks the start of a spend proof in Monero's format.
Root cause: why it works
The spend-proof challenge is derived from the caller-supplied txid, but the transaction body used for the ring signature checks comes from whatever the daemon returned. Because the parsed tx_hash is never compared with txid, a malicious or compromised daemon can answer a request for txid B with a valid serialised body for a different transaction A. The wallet signs or verifies over B while using the inputs, key images and rings from A.
The existing defence on the neighbouring code path is the tx_hash != txid guard in check_tx_proof. It was simply not applied to get_spend_proof and check_spend_proof. The report notes that the missing guard is plain in the source and that any branch with this spend-proof code path behaves the same unless someone has already merged an equivalent check. In other words, this is not a subtle race or a rare configuration; it is a check that is absent from the code as written.
Impact: what an attacker gains
A malicious, compromised or MITM daemon can break the integrity binding of SpendProofV1. In the PoC, a random FAKE txid cannot produce a spend proof against the honest daemon, but when /gettransactions is substituted with a real wallet-originated transaction body, get_spend_proof(txid=FAKE) succeeds and check_spend_proof(txid=FAKE, signature=...) returns good: true behind the same malicious daemon.
This can mislead services or automation that rely on check_spend_proof as evidence that a user created or spent a specific transaction id, if their wallet-rpc verifier is connected to an attacker-controlled, compromised or MITM'd daemon.
The report is explicit about the limits: this is not a private-key leak, fund theft, consensus issue or RCE. Consensus means agreement across the whole network about the ledger; RCE means remote code execution, an attacker running their own code on your machine. Neither happens here. The precondition is control of the wallet-to-daemon response path, and the impact is proof authenticity and integrity failure.
Fix: what should change
After get_pruned_tx(res.txs[0], tx, tx_hash) succeeds in both get_spend_proof and check_spend_proof, add the same guard used by check_tx_proof:
THROW_WALLET_EXCEPTION_IF(tx_hash != txid, error::wallet_internal_error,
"Failed to get the right transaction from daemon");
This is the same three-part check explained earlier: if the hash of the returned data differs from the requested id, stop with an error instead of signing or verifying. It is a few lines, and it makes the wallet refuse to work with a transaction it did not ask for.
A regression test should also be added, using a daemon fixture or mocked HTTP, that returns a blob whose id does not match the requested hash. A fixture is a canned, fake response used in tests; mocked HTTP means replacing the real network with a stand-in that returns prepared answers. Both entry points should bail before signing or verifying, and the test locks that behaviour in.
- Other proof helpers on the same RPC path. Look for functions that fetch a transaction and then build a challenge from a caller-supplied id. A positive result is a helper that signs or verifies successfully when the daemon returns a body for a different transaction.
- Compare against guarded siblings. Where one function in a file performs a
tx_hash != txidcheck and a neighbouring function does not, test the unguarded one with a substituted/gettransactionsresponse. A positive result is a proof that verifies for an id the daemon never actually returned. - Proxy substitution on
POST /gettransactions. Replace a requestedtxs_hashesentry with the hash of a real transaction and see whether the client accepts the body. A positive result is a client that proceeds without noticing the mismatch. - Honest-daemon control run. Repeat the same request without the proxy. A positive result for the vulnerability is the honest daemon refusing to produce a proof for the fake id, which confirms the earlier success depended on the substitution.
- Regression test with a mismatched blob. Feed both entry points a blob whose id differs from the requested hash. A positive result is both functions throwing before any signing or verification takes place.
Glossary
- API: the agreed set of requests one program can send to another, and the format of the answers.
- Blob: a chunk of binary data, here a serialised transaction.
- Challenge: the exact data a signature is made over; both sides must build it identically.
- Consensus: agreement across all nodes of a cryptocurrency network about the state of the ledger.
- Daemon: a program that runs in the background and serves requests; here the Monero node,
monerod. - Fixture: a canned, fake response used in automated tests.
- Hash: a fixed-length fingerprint of data; any change to the input changes the fingerprint.
- HTTP: the protocol browsers and programs use to talk to servers.
- Integrity: the property that data has not been altered in transit or storage.
- Key image: a one-time marker in Monero that prevents the same coin being spent twice.
- MITM (man in the middle): an attacker positioned on the network path who can read or alter messages.
- Mocked HTTP: replacing the real network in a test with a stand-in that returns prepared answers.
- Node: a computer running software that keeps a copy of the blockchain and answers queries about it.
- POST: an HTTP method meaning "here is data, act on it".
- Pruned transaction: a transaction stored without some optional bulky data, enough to verify it.
- RCE (remote code execution): an attacker running their own code on someone else's machine.
- Regression test: an automated test that ensures a fixed bug cannot return unnoticed.
- Repository: the shared folder where a project's source code and history are kept.
- Reverse proxy: a program that stands in front of a server and forwards, and possibly rewrites, requests.
- Ring signature: Monero's signature scheme that hides which of several possible signers actually signed.
- RPC (remote procedure call): an API style where one program asks another to run a named function, often over HTTP.
- Signature: a cryptographic stamp proving the holder of a secret key approved exact data.
- Spend proof: a signature tying a transaction id and a message together, used as evidence that a transaction was created or spent.
- Transaction: a record of coins moving from one place to another.
- txid: the unique identifier of a transaction, a hash of its data.
txs_hashes: the list of transaction ids in a/gettransactionsrequest.- Wallet: software that holds the keys to coins and lets a person spend them.