[Pkg-privacy-maintainers] Bug#1074536: torbrowser-launcher: New path for self-updated TorBrowser needs to be (back)ported to bookworm's apparmor files

Tore Ferner torfer at pvv.org
Sun Jun 30 14:10:51 BST 2024


Package: torbrowser-launcher
Version: 0.3.6-2
Severity: normal
X-Debbugs-Cc: torfer at pvv.org

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

During normal TorBrowser browsing and updating, the TorBrowser installs itself under a folder named

 /home/*/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser/Browser/firefox.real

rather than

 /home/*/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser_*/Browser/firefox.real

So, torbrowser is thereafter not contained by apparmor restrictions and seems to work normally, i.e. you do not notice that you have reduced security.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

To get a working browser contained by apparmor, I changed the paths in the apparmor files for 0.3.6 thusly (being backward compatible for an *older* TorBrowser version that might still be installed):

$ diff -u torbrowser.Browser.firefox /etc/apparmor.d/torbrowser.Browser.firefox
--- torbrowser.Browser.firefox	2024-06-30 14:26:09.000000000 +0200
+++ /etc/apparmor.d/torbrowser.Browser.firefox	2024-06-30 13:53:05.311187709 +0200
@@ -1,7 +1,7 @@
 #include <tunables/global>
 #include <tunables/torbrowser>
 
-@{torbrowser_firefox_executable} = /home/*/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser_*/Browser/firefox.real
+@{torbrowser_firefox_executable} = /home/*/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser*/Browser/firefox.real
 
 profile torbrowser_firefox @{torbrowser_firefox_executable} {
   #include <abstractions/audio>

$ diff -u torbrowser.Tor.tor /etc/apparmor.d/torbrowser.Tor.tor
--- torbrowser.Tor.tor	2024-06-30 14:26:09.000000000 +0200
+++ /etc/apparmor.d/torbrowser.Tor.tor	2024-06-30 14:12:04.088334553 +0200
@@ -1,7 +1,7 @@
 #include <tunables/global>
 #include <tunables/torbrowser>
 
-@{torbrowser_tor_executable} = /home/*/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser_*/Browser/TorBrowser/Tor/tor
+@{torbrowser_tor_executable} = /home/*/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser*/Browser/TorBrowser/Tor/tor
 
 profile torbrowser_tor @{torbrowser_tor_executable} {
   #include <abstractions/base>

$ diff -u tunables/torbrowser /etc/apparmor.d/tunables/torbrowser
--- tunables/torbrowser	2022-12-14 03:19:17.000000000 +0100
+++ /etc/apparmor.d/tunables/torbrowser	2024-06-30 13:57:19.943311428 +0200
@@ -1,2 +1,2 @@
-@{torbrowser_installation_dir}=@{HOME}/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser_*
+@{torbrowser_installation_dir}=@{HOME}/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser*
 @{torbrowser_home_dir}=@{torbrowser_installation_dir}/Browser

   * What was the outcome of this action?

I've noticed that version 0.3.7 in sid has updated these paths to be *only* compatible with the new paths.
The other changes to 0.3.7's version of torbrowser.Browser.firefox might be necessary; I haven't investigated that, but with the new paths above torbrowser and its tor process is under apparmor's enforce mode and I can browse some simple web pages.

   * What outcome did you expect instead?

N/A

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: 12.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 'testing'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-21-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=nb_NO.UTF-8, LC_CTYPE=nb_NO.UTF-8 (charmap=UTF-8), LANGUAGE=nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages torbrowser-launcher depends on:
ii  ca-certificates    20230311
ii  gnupg              2.2.40-1.1
ii  libdbus-glib-1-2   0.112-3
ii  libgtk-3-0         3.24.38-2~deb12u1
ii  python3            3.11.2-1+b1
ii  python3-gpg        1.18.0-3+b1
ii  python3-packaging  23.0-1
ii  python3-pyqt5      5.15.9+dfsg-1
ii  python3-requests   2.28.1+dfsg-1
ii  python3-socks      1.7.1+dfsg-1

Versions of packages torbrowser-launcher recommends:
ii  tor  0.4.8.12-1~bpo12+1

Versions of packages torbrowser-launcher suggests:
ii  apparmor  3.0.8-3

-- Configuration Files:
/etc/apparmor.d/torbrowser.Browser.firefox changed:
@{torbrowser_firefox_executable} = /home/*/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser*/Browser/firefox.real
profile torbrowser_firefox @{torbrowser_firefox_executable} {
  #include <abstractions/audio>
  #include <abstractions/dri-enumerate>
  #include <abstractions/gnome>
  #include <abstractions/ibus>
  #include <abstractions/mesa>
  #include <abstractions/opencl>
  #include if exists <abstractions/vulkan>
  #include if exists <abstractions/dbus-session>
  #include if exists <abstractions/X>
  # Uncomment the following lines if you want to give the Tor Browser read-write
  # access to most of your personal files.
  # #include <abstractions/user-download>
  # @{HOME}/ r,
  # Audio support
  /{,usr/}bin/pulseaudio Pixr,
  #dbus,
  network netlink raw,
  network tcp,
  ptrace (trace) peer=@{profile_name},
  signal (receive, send) set=("term") peer=@{profile_name},
  deny /etc/host.conf r,
  deny /etc/hosts r,
  deny /etc/nsswitch.conf r,
  deny /etc/os-release r,
  deny /etc/resolv.conf r,
  deny /etc/passwd r,
  deny /etc/group r,
  deny /etc/mailcap r,
  /etc/machine-id r,
  /var/lib/dbus/machine-id r,
  /dev/ r,
  /dev/shm/ r,
  owner @{PROC}/@{pid}/cgroup r,
  owner @{PROC}/@{pid}/environ r,
  owner @{PROC}/@{pid}/fd/ r,
  owner @{PROC}/@{pid}/mountinfo r,
  owner @{PROC}/@{pid}/smaps r,
  owner @{PROC}/@{pid}/stat r,
  owner @{PROC}/@{pid}/statm r,
  owner @{PROC}/@{pid}/status r,
  owner @{PROC}/@{pid}/task/*/stat r,
  @{PROC}/sys/kernel/random/uuid r,
  owner @{torbrowser_installation_dir}/ r,
  owner @{torbrowser_installation_dir}/* r,
  owner @{torbrowser_installation_dir}/.** rwk,
  owner @{torbrowser_installation_dir}/update.test/ rwk,
  owner @{torbrowser_home_dir}/.** rwk,
  owner @{torbrowser_home_dir}/ rw,
  owner @{torbrowser_home_dir}/** rwk,
  owner @{torbrowser_home_dir}.bak/ rwk,
  owner @{torbrowser_home_dir}.bak/** rwk,
  owner @{torbrowser_home_dir}/*.so mr,
  owner @{torbrowser_home_dir}/.cache/fontconfig/ rwk,
  owner @{torbrowser_home_dir}/.cache/fontconfig/** rwkl,
  owner @{torbrowser_home_dir}/browser/** r,
  owner @{torbrowser_home_dir}/{,browser/}components/*.so mr,
  owner @{torbrowser_home_dir}/Downloads/ rwk,
  owner @{torbrowser_home_dir}/Downloads/** rwk,
  owner @{torbrowser_home_dir}/firefox rix,
  owner @{torbrowser_home_dir}/{,TorBrowser/UpdateInfo/}updates/[0-9]*/* rw,
  owner @{torbrowser_home_dir}/{,TorBrowser/UpdateInfo/}updates/[0-9]*/{,MozUpdater/bgupdate/}updater ix,
  owner @{torbrowser_home_dir}/updater ix,
  owner @{torbrowser_home_dir}/TorBrowser/Data/Browser/.parentwritetest rw,
  owner @{torbrowser_home_dir}/TorBrowser/Data/Browser/profiles.ini r,
  owner @{torbrowser_home_dir}/TorBrowser/Data/Browser/profile.default/{,**} rwk,
  owner @{torbrowser_home_dir}/TorBrowser/Data/fontconfig/fonts.conf r,
  owner @{torbrowser_home_dir}/fonts/* l,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/tor px,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/ r,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/*.so mr,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/*.so.* mr,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/libstdc++/*.so mr,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/libstdc++/*.so.* mr,
  # parent Firefox process when restarting after upgrade, Web Content processes
  owner @{torbrowser_firefox_executable} pxmr -> torbrowser_firefox,
  /etc/mailcap r,
  /etc/mime.types r,
  /usr/share/ r,
  /usr/share/glib-2.0/schemas/gschemas.compiled r,
  /usr/share/mime/ r,
  /usr/share/themes/ r,
  /usr/share/applications/** rk,
  /usr/share/gnome/applications/ r,
  /usr/share/gnome/applications/kde4/ r,
  /usr/share/poppler/cMap/ r,
  /etc/xdg/mimeapps.list r,
  # Distribution homepage
  /usr/share/homepage/ r,
  /usr/share/homepage/** r,
  /sys/bus/pci/devices/ r,
  @{sys}/devices/pci[0-9]*/**/irq r,
  /sys/devices/system/cpu/ r,
  /sys/devices/system/cpu/present r,
  /sys/devices/system/node/ r,
  /sys/devices/system/node/node[0-9]*/meminfo r,
  /sys/fs/cgroup/cpu,cpuacct/{,user.slice/}cpu.cfs_quota_us r,
  deny /sys/devices/virtual/block/*/uevent r,
  # Should use abstractions/gstreamer instead once merged upstream
  /etc/udev/udev.conf r,
  /run/udev/data/+pci:* r,
  /sys/devices/pci[0-9]*/**/uevent r,
  owner /{dev,run}/shm/shmfd-* rw,
  # Required for multiprocess Firefox (aka Electrolysis, i.e. e10s)
  owner /{dev,run}/shm/org.chromium.* rw,
  owner /dev/shm/org.mozilla.ipc.[0-9]*.[0-9]* rw, # for Chromium IPC
  # Required for Wayland display protocol support
  owner /dev/shm/wayland.mozilla.ipc.[0-9]* rw,
  # Silence denial logs about permissions we don't need
  deny @{HOME}/.cache/fontconfig/ rw,
  deny @{HOME}/.cache/fontconfig/** rw,
  deny @{HOME}/.config/gtk-2.0/ rw,
  deny @{HOME}/.config/gtk-2.0/** rw,
  deny @{PROC}/@{pid}/net/route r,
  deny /sys/devices/system/cpu/cpufreq/policy[0-9]*/cpuinfo_max_freq r,
  deny /sys/devices/system/cpu/*/cache/index[0-9]*/size r,
  deny /run/user/[0-9]*/dconf/user rw,
  deny /usr/bin/lsb_release x,
  # Silence denial logs about PulseAudio
  deny /etc/pulse/client.conf r,
  deny /usr/bin/pulseaudio x,
  # KDE 4
  owner @{HOME}/.kde/share/config/* r,
  # Xfce4
  /etc/xfce4/defaults.list r,
  /usr/share/xfce4/applications/ r,
  # u2f (tested with Yubikey 4)
  /sys/class/ r,
  /sys/bus/ r,
  /sys/class/hidraw/ r,
  /run/udev/data/c24{5,7,9}:* r,
  /dev/hidraw* rw,
  # Yubikey NEO also needs this:
  /sys/devices/**/hidraw/hidraw*/uevent r,
  # Needed for Firefox sandboxing via unprivileged user namespaces
  capability sys_admin,
  capability sys_chroot,
  owner @{PROC}/@{pid}/{gid,uid}_map w,
  owner @{PROC}/@{pid}/setgroups w,
  # Remove these rules once we can assume abstractions/vulkan is recent enough
  # to include them
  /etc/glvnd/egl_vendor.d/{*,.json} r,
  /usr/share/glvnd/egl_vendor.d/{,*.json} r,
  #include <local/torbrowser.Browser.firefox>
}

/etc/apparmor.d/torbrowser.Tor.tor changed:
@{torbrowser_tor_executable} = /home/*/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser*/Browser/TorBrowser/Tor/tor
profile torbrowser_tor @{torbrowser_tor_executable} {
  #include <abstractions/base>
  network netlink raw,
  network tcp,
  network udp,
  /etc/host.conf r,
  /etc/nsswitch.conf r,
  /etc/passwd r,
  /etc/resolv.conf r,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/tor mr,
  owner @{torbrowser_home_dir}/TorBrowser/Data/Tor/ rw,
  owner @{torbrowser_home_dir}/TorBrowser/Data/Tor/** rw,
  owner @{torbrowser_home_dir}/TorBrowser/Data/Tor/lock rwk,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/*.so mr,
  owner @{torbrowser_home_dir}/TorBrowser/Tor/*.so.* mr,
  # Support some of the included pluggable transports
  owner @{torbrowser_home_dir}/TorBrowser/Tor/PluggableTransports/** rix,
  @{PROC}/sys/net/core/somaxconn r,
  #include <abstractions/ssl_certs>
  # Silence file_inherit logs
  deny @{torbrowser_home_dir}/{browser/,}omni.ja r,
  deny @{torbrowser_home_dir}/{browser/,}features/*.xpi r,
  deny @{torbrowser_home_dir}/TorBrowser/Data/Browser/profile.default/.parentlock rw,
  deny @{torbrowser_home_dir}/TorBrowser/Data/Browser/profile.default/extensions/*.xpi r,
  deny @{torbrowser_home_dir}/TorBrowser/Data/Browser/profile.default/startupCache/* r,
  # Silence logs from included pluggable transports
  deny /etc/hosts r,
  deny /etc/services r,
  @{PROC}/sys/kernel/random/uuid r,
  /sys/devices/system/cpu/ r,
  /sys/kernel/mm/transparent_hugepage/hpage_pmd_size r,
  # OnionShare compatibility
  /tmp/onionshare/** rw,
  #include <local/torbrowser.Tor.tor>
}

/etc/apparmor.d/tunables/torbrowser changed:
@{torbrowser_installation_dir}=@{HOME}/.local/share/torbrowser/tbb/{i686,x86_64}/tor-browser*
@{torbrowser_home_dir}=@{torbrowser_installation_dir}/Browser


-- no debconf information



More information about the Pkg-privacy-maintainers mailing list