mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 09:38:38 +00:00
torcontrol: send -torpassword hex-encoded to avoid escaping bugs #36637
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36637
Loading…
Reference in a new issue
No description provided.
Delete branch "tor-escape"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Tor password was sent as a
QuotedStringwith only double quotes escaped; as Tor interprets backslash escapes inside it, any password containing a backslash was mangled (or left the string unterminated).The Tor Control spec deliberately allows the token to be sent as unquoted hex "to avoid escaping issues", as the
SAFECOOKIEresponse already is. This patch does the same for the password, and also adds a functional test covering backslashes and quotes.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
🔵 Suggestion · Legacy backslash escaping lacks migration guidance
Users who doubled backslashes in
-torpasswordto work around the old escaping bug will fail Tor authentication after upgrading, preventing automatic onion-service creation, but the PR provides no migration note.Location:
src/torcontrol.cpp:695(head).Review coverage was incomplete.
Reviewed:
5a699cc25398· Full review report · Previous reportspermalink
i think the motivation here is good since hex-encoding removes the need for escaping entirely. concept ACK
also, the TOR control spec explicitly allows this:
re: https://github.com/bitcoin/bitcoin/pull/36637#issue-6008559379
#36374 is already underway to fix this specific issue by handling backslash escaping
the two PRs solve the same bug in different ways, so whichever approach reviewers prefer may make the other redundant. this one avoids escaping altogether, while #36374 handles it explicitly
ACK
87ada85658Here is the relevant Tor documentation:
https://spec.torproject.org/control-spec/commands.html?highlight=hashedpa#authenticate
I find it strange that the auth method is called HASHED PASSWORD but the password is sent in clear text 🤔
Show Signature
vasild's public key is on openpgp.org
nit:
Using
extra_args=[]would cause this to faillint_py_lintin CI, though, yes?ralph llm nit
Update the password-authentication example (src/torcontrol.cpp:667, head)
The local summary still documents the password as a quoted token, but this command sends its hex encoding. Update the example or remove it so the authentication summary matches the wire format.
the mock could explicitly check the received hex and reply with a
515 Bad authenticationif it does not match, rather than accepting anyAUTHENTICATEdiff
https://github.com/bitcoin/bitcoin/pull/36637#discussion_r4375707823 is worth exploring too :)
tested ACK
a1903e3abesuccessfully built and tested on: Windows
10/MSVC19.51.36257/x86_64🐙 This pull request conflicts with the target branch and needs rebase.
Tested ACK
5a699cc253re-ACK
5a699cc253if this gets merged, #36374 will become obsolete and closed in favour of this one since reviewers seem more interested in this approach
ACK
5a699cc253Reviewed the code and did some light local testing to confirm this fixes the issues discussed #36374.
ACK
5a699cc253