Trusted daemon check fails when proxied through torsocks or proxychains
The wallet's check for whether a daemon is local returns true for onion addresses when the process is proxied through torsocks or proxychains, because those tools resolve the address to loopback. An attacker operating a remote node could therefore receive private data that the wallet only sends to trusted daemons.
- Triaged in 46 hours
- Fixed in 33 days
- Disclosed after 60 days
Summary:
If torsocks(1) or proxychains(1) is enforced when using Monero wallet with a remote node without explicit --untrusted-daemon arguments given, the application will assume the daemon is trusted.
Description:
By default, the wallet checks if the daemon address can be trusted by calling tools::is_local_address when --trust-daemon is not set. However, if the process is proxied through torsocks(1) or proxychains(1), which resolves onion addresses into a loopback address that is handled by them internally, is_local_address will return true on such address, while the actual node should be considered untrusted.
This issue may sound trivial and I also noticed a new argument --untrusted-daemon has been added in commit c4907d24cb32129ee52a53711547c5d54960c431, but not all users using a remote node with torsocks or proxychains are aware of this. Essentially, we can't really tell if the address is really local, and current judgement of it doesn't make a sufficient condition that the daemon can be trusted.
Releases Affected:
- Monero CLI wallet (@master)
- Monero GUI wallet (@master)
Steps To Reproduce:
- Run the CLI wallet with
torsocks monero-wallet-cli --daemon-address zdhkwneu7lfaum2p.onion:18099 - Authenticate the wallet and sync.
- Send command
rescan_bc, which should be available only if the daemon is trusted. - The command executed successfully.
Supporting Material/References:
None
Possible Solutions:
- Add an extra condition in src/common/util.cpp function is_local_address to judge if the daemon address ends with .onion or .i2p etc..
- Prompt the user explicitly if the daemon can be trusted.
Impact
Possible private data disclosure to the untrusted remote node.
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 trust decision relies only on whether the resolved daemon address is a loopback address, which is not a sufficient condition when a proxy such as torsocks or proxychains maps remote onion addresses to loopback.
Impact
Private data could be disclosed to an untrusted remote node, because commands meant only for a trusted local daemon are allowed.
What the attacker needed
Wallet run through torsocks or proxychains; remote daemon address; no --untrusted-daemon flag
The fix
The check should also treat onion or i2p addresses as untrusted, or the user should be prompted explicitly to confirm whether the daemon can be trusted.
How it was found
- Run the CLI wallet through torsocks with a remote onion daemon address.
- Authenticate the wallet and sync.
- Run the rescan_bc command, which should only be available for a trusted daemon.
- Observe that the command executes successfully.
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.
A wallet can connect to a 'daemon', a server that helps it read the blockchain. Some commands, like rescan_bc, should only run when that server is on your own machine, because they can reveal private information. The wallet decides 'local' by looking at the address, and a proxy tool makes a remote onion address look local, so the wallet wrongly trusts a stranger's server.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.