mirror of
https://github.com/google/nsjail.git
synced 2026-08-30 18:41:30 -07:00
Merge pull request #283 from h1-mrz/harden-proc-mount-flags
mnt: mount the auto-provisioned /proc nosuid,nodev,noexec
This commit is contained in:
11
cmdline.cc
11
cmdline.cc
@@ -480,6 +480,17 @@ static bool setupMounts(nsj_t* nsj) {
|
|||||||
p->set_fstype("proc");
|
p->set_fstype("proc");
|
||||||
p->set_rw(nsj->is_proc_rw);
|
p->set_rw(nsj->is_proc_rw);
|
||||||
p->set_is_dir(true);
|
p->set_is_dir(true);
|
||||||
|
/*
|
||||||
|
* Mount the auto-provisioned procfs nosuid+nodev+noexec, matching the
|
||||||
|
* convention used by every other container runtime (runc, Docker,
|
||||||
|
* systemd-nspawn). There is no legitimate reason for /proc to honor
|
||||||
|
* setuid bits, expose device nodes, or allow execution, and doing so
|
||||||
|
* needlessly widens the in-jail attack surface (e.g. a setuid binary
|
||||||
|
* or device node reachable via a procfs path).
|
||||||
|
*/
|
||||||
|
p->set_nosuid(true);
|
||||||
|
p->set_nodev(true);
|
||||||
|
p->set_noexec(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user