Skip to content

SocksPort WorldWritable sets file mode to 755 instead of 666

Summary

Unix domain sockets that are configured to be WorldWritable have incorrect permissions. Such sockets are unusable as a result, since write access is needed for clients to work.

Steps to reproduce:

  1. Use a configuration file with the following options, where /usr/local/var/run/tor is a directory with appropriate permissions:
SocksPort unix:/usr/local/var/run/tor/socks-group GroupWritable RelaxDirCheck
SocksPort unix:/usr/local/var/run/tor/socks-world WorldWritable
  1. Run the following command to view their permissions:
stat /usr/local/var/run/tor/socks-group /usr/local/var/run/tor/socks-world

Note that listening on two sockets is not necessary to reproduce this bug: it merely makes it easier to see the difference.

What is the current bug behavior?

Sockets with WorldWritable have the wrong permissions, in contrast to the correctly-implemented GroupWritable:

srw-rw---- /usr/local/var/run/tor/socks-group
srwxr-xr-x /usr/local/var/run/tor/socks-world

What is the expected behavior?

srw-rw---- /usr/local/var/run/tor/socks-group
srw-rw-rw- /usr/local/var/run/tor/socks-world

Environment

  • Which version of Tor are you using? Run tor --version to get the version if you are unsure.

0.4.7.10

  • Which operating system are you using? For example: Debian GNU/Linux 10.1, Windows 10, Ubuntu Xenial, FreeBSD 12.2, etc.

macOS 12.6

  • Which installation method did you use? Distribution package (apt, pkg, homebrew), from source tarball, from Git, etc.

Homebrew

Relevant logs and/or screenshots

N/A: even Log debug doesn't say anything beyond noting that a socket is successfully opened.

Possible fixes

Investigate whether this conditional statement is somehow causing an issue.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information