Problem: A node creates its onion service through Tor's control protocol and caches the returned private key for reconnects.
Quoted reply values are unescaped, so a control endpoint can return an escaped line break that becomes part of the cached key.
When the node reconnects, it authenticates to Tor and inserts that key into an ADD_ONION command, where the embedded CRLF frames the remainder as a separate control command.
An unprivileged local process can exploit this by impersonating the default loopback endpoint while Tor is unavailable, seeding the cache, and releasing the port before Tor returns. A compromised operator-configured endpoint can return the same malicious key. The functional test demonstrates SIGNAL SHUTDOWN. No P2P or RPC input reaches this path.
Fix: This PR rejects CR and LF in every outbound Tor control command and rejects a returned private key before adopting or caching it. The outbound-command check also protects nodes with an existing malformed cache and covers line breaks in -torpassword. Valid Tor keys are unaffected. A malformed cached key leaves the onion service unavailable until the operator removes the file and restarts the node, but can no longer frame another command.