RingCT malformed tx prevents target from being able to sweep balance
A malformed RingCT transaction with a manipulated amount mask causes the victim's wallet to fail when sweeping the balance, showing an internal error. An attacker can send such a transaction to any public Monero address, preventing the victim from sweeping funds until they patch and rescan.
Originally disclosed on HackerOne
- Triaged in 25 hours
- Fixed in 14 days
- Disclosed after 44 days
Summary:
An attacker can send a malformed RingCT transaction to an attackee wallet that prevents the attackee from sweeping their wallet balance. This is done by the attacker changing the mask amount in genRctSimple with a modified wallet. The attacker does not need any intervention from the attackee other than their public Monero address.
Releases Affected:
- Affects all versions of monero-wallet-cli and monero-wallet-rpc
Steps To Reproduce:
- Clone and compile the v0.14.0.2 tagged branch of monero-project/monero
- Create a new attackee wallet on stagenet. Load it up by sending a few transactions of various amounts to this wallet.
- Create a new attacker wallet on stagenet. Send one small amount of coins such as 0.1 XMR.
- Modify this line in rctSigs.cpp to
rv.ecdhInfo[i].amount = d2h(MONEY_SUPPLY); - Recompile monero-project/monero
- Open the attacker wallet and send a transaction to the attackee wallet. The amount you select to transfer does not matter. Send 0.05 XMR as an example.
- Switch back to upstream code without the patch from step 4.
- Open the attackee wallet and wait for network confirmations. The malformed transaction will correctly show up as 0 XMR.
- Attempt to sweep all from the attackee wallet to any destination. The attackee wallet will throw an error: “Error: internal error: Daemon response did not include the requested real output.”
How to fix this:
The bug is fixed by changing two lines in wallet2.cpp. After this conditional add if (!tx_scan_info.money_transfered) { return; } outs.push_back(i); and remove outs.push_back(i); from a few lines earlier. Recompile and rescan the attackee wallet.
Supporting Material/References:
This bug was found by carefully inspecting this ryo-currency commit which was suggested to have a bug fix within. This one line fix makes itself evident because there is no relation to coinbase outputs on this line.
Attackee example stagenet wallet seed:
yesterday doorway sizes royal sipped mesh nephew around
idols laptop cactus present imagine ponies puzzled auctions
poaching jogger surfer launching phase rewind soda tequila ponies
Impact
An attacker can send malformed transactions and prevent an attackee from being able to sweep their balance. The attackee needs to apply the patch described above and rescan their wallet if they have been affected. Since this attack doesn’t cause permanent damage, it is less severe, however forcing the attackee to rescan their wallet causes loss of data such as tx secret keys.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the wallet's output selection logic includes outputs with zero transferred amount, which later causes a failure when constructing a sweep transaction.
Impact
An attacker can prevent the victim from sweeping their balance, forcing them to patch and rescan; this causes loss of data such as transaction secret keys but no permanent damage.
What the attacker needed
Victim's public Monero address; attacker can send transactions
How it was found
- Compile the vulnerable Monero version.
- Create a victim wallet on stagenet and fund it with several transactions.
- Create an attacker wallet and send a small amount to it.
- Modify the amount mask in the transaction creation code to an invalid value.
- Recompile and send a transaction from the attacker wallet to the victim wallet.
- Switch back to unmodified code, open the victim wallet, and attempt to sweep all funds; it fails with an internal error.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Monero is a privacy-focused cryptocurrency. A transaction includes hidden amounts. The attacker crafts a transaction where the hidden amount is set to an impossible value. When the victim's wallet tries to spend all its money, it gets confused by this bad transaction and refuses to work. The victim must update their wallet software and rescan the blockchain to fix it.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.