Skip to content

Commit a53c04b

Browse files
committed
Enable ptrace protection for browser sandbox
Only allow ptrace from a parent process to its children or via CAP_SYS_PTRACE. To verify sandbox status for Brave, Chrome, Firefox see brave://sandbox, chrome://sandbox, about:support, respectively. Also describe disadvantages of enabling unprivileged user namespaces. Distributions like Debian currently disable unprivileged user namespaces by default to decrease the kernel attack surface for local privilege escalation. See Debian bug #898446. If kept disabled, Brave 1.2+ and Chrome will still enforce namespace sandboxing via their setuid-root helper executable. See brave/brave-browser#3420 and brave/brave-browser#6247. Firefox does not include a setuid-root binary, however, so unprivileged user namespaces are useful to have for defence-in-depth, but not critical. See <https://www.morbo.org/2018/05/linux-sandboxing-improvements-in_10.html>.
1 parent 3f82d9e commit a53c04b

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class ocf::browser_sandbox {
2+
# Change kernel settings for the sandbox used by Brave, Chrome, and Firefox.
3+
# Verify sandbox status at brave://sandbox, chrome://sandbox, about:support,
4+
# respectively.
5+
sysctl {
6+
# Distributions like Debian currently disable unprivileged user namespaces
7+
# by default to decrease the kernel attack surface for local privilege
8+
# escalation. See Debian bug #898446. If kept disabled, Brave 1.2+ and
9+
# Chrome will still enforce namespace sandboxing via their setuid-root
10+
# helper executable. See brave/brave-browser#3420 and
11+
# brave/brave-browser#6247. Firefox does not include a setuid-root binary,
12+
# however, so unprivileged user namespaces are useful to have for
13+
# defense in depth, but not critical. See
14+
# <https://www.morbo.org/2018/05/linux-sandboxing-improvements-in_10.html>.
15+
'kernel.unprivileged_userns_clone':
16+
value => '1';
17+
# Enable ptrace protection. Only allow ptrace from a parent process to its
18+
# children or via CAP_SYS_PTRACE.
19+
'kernel.yama.ptrace_scope':
20+
value => '1';
21+
}
22+
}

modules/ocf/manifests/packages/brave.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class ocf::packages::brave {
2-
include ocf::userns
2+
include ocf::browser_sandbox
33

44
$browser_homepage = lookup('browser_homepage')
55

modules/ocf/manifests/packages/chrome.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class ocf::packages::chrome {
2-
include ocf::userns
2+
include ocf::browser_sandbox
33

44
$browser_homepage = lookup('browser_homepage')
55

modules/ocf/manifests/packages/firefox.pp

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class ocf::packages::firefox {
2+
include ocf::browser_sandbox
3+
24
$browser_homepage = lookup('browser_homepage')
35

46
package { 'firefox-esr':; }

modules/ocf/manifests/userns.pp

-9
This file was deleted.

0 commit comments

Comments
 (0)