util: ESocksProxy: add fixme for is_proxy_tor race
What changed, and why it matters
This commit only adds a code comment (a 'FIXME') noting a race condition in Electrum's SOCKS proxy handling. The actual behavior is not changed. The race could mean that when Electrum is still checking whether a proxy is a Tor proxy, it might incorrectly reuse Tor circuits instead of waiting for the check to finish. This is a potential privacy/ anonymity concern for users routing traffic through Tor, but no exploit or direct fund theft is evident from the diff alone.
Treat as a low-severity note for developers. Users relying on Tor should be aware that circuit reuse may occur during proxy type probing. A future patch should make the SOCKS authentication path wait or block until is_proxy_tor is resolved from None to True/False.
Security signals we found
Race condition between Tor proxy detection and SOCKS authentication decision
Potential Tor circuit reuse before proxy type is confirmed
Privacy/anonymity degradation possible for Tor-routed users
No functional code change; issue is only annotated
Evidence from the diff
In electrum/util.py, inside ESocksProxy, a FIXME comment is added at the point where proxy username/password authentication is decided. The code checks network.is_proxy_tor, which can be None while a probe is in progress. The comment notes that if the value is None, the code should wait for the probe to complete rather than falling through to the non-Tor path, because the current behavior reuses Tor circuits. The patch does not implement any fix; it merely documents the issue.
Changed components
electrum/util.pyESocksProxy classTor proxy detection logicInspect captured patch +1 / −0
diff --git a/electrum/util.py b/electrum/util.py
index 33a90b2..055c5bd 100644
--- a/electrum/util.py
+++ b/electrum/util.py
@@ -2201,6 +2201,7 @@ class ESocksProxy(aiorpcx.SOCKSProxy):
username, pw = proxy.user, proxy.password
if not username or not pw:
# is_proxy_tor is tri-state; None indicates it is still probing the proxy to test for TOR
+ # FIXME race: if is_proxy_tor is None, we should wait until it gets set. Instead now we reuse Tor circuits.
if network.is_proxy_tor:
auth = aiorpcx.socks.SOCKSRandomAuth()
else:
Why this scored 26/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.