Skip to content

Fix a batch of Tor-related issues - #3354

Open
t-bast wants to merge 3 commits into
masterfrom
loupe-medium-issues
Open

Fix a batch of Tor-related issues#3354
t-bast wants to merge 3 commits into
masterfrom
loupe-medium-issues

Conversation

@t-bast

@t-bast t-bast commented Aug 13, 2026

Copy link
Copy Markdown
Member

This PR contains several independent commits that fix low/medium severity issues for our Tor support found by Loupe (https://github.com/project-loupe/). Most of them require malicious infrastructure, so it's very likely that they haven't been exploited. They are rather part of a defense-in-depth strategy.

@rorp would appreciate your review 🙏

t-bast added 2 commits August 13, 2026 16:16
In order to be valid, a Tor cookie must be exactly 32 bytes.
We verify that and fail otherwise.
And fail if password mode is used but the host is remote.
@t-bast t-bast changed the title Fix a batch of low/medium severity issues Fix a batch of Tor-related issues Aug 13, 2026
There was a race condition in file permissions that allowed attackers
on the machine to read secrets, because we started by creating the
secret and only after that we set the file permissions.

We now reverse that flow: we create an empty file with the right
permissions and then write the secret to it.

This applies to our seed files and to tor private keys.
@t-bast
t-bast requested a review from sstone August 13, 2026 15:34
@t-bast
t-bast marked this pull request as ready for review August 13, 2026 15:34
Files.write(path.toPath, seed.toArray)
// Seed files derive the node identity key and all channel keys: they must never be readable by other local users.
setOwnerPermissions(path.toPath, "rw-------")
writeSecret(path.toPath, seed.toArray)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rorp this is effectively a fixup for your PR #3340

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

override def receive: Receive = {
case Connected(_, _) =>
case Connected(remoteAddress, _) =>
checkControlAddress(remoteAddress)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rorp rorp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants