View Issue Details

IDProjectCategoryView StatusLast Update
0000471fileGeneralpublic2024-02-04 20:04
Reporteramonakov Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.45 
Fixed in VersionHEAD 
Summary0000471: seccomp: remove prctl(PR_SET_DUMPABLE) snake oil
DescriptionMaking the process "not dumpable" has the following effects:

* core dumps are not produced
* ptrace-attaching to this process is disallowed
* files in /proc/<pid> become owned by root

Hence, it doesn't contribute to seccomp's goal of preventing attacks via
a hijacked 'file' process, and instead limits the ability to observe a
running (or crashing) 'file' program, which is not a goal.

Attaching the corresponding patch.
TagsNo tags attached.

Activities

amonakov

2023-08-07 16:21

reporter  

0001-seccomp-remove-prctl-PR_SET_DUMPABLE-snake-oil.patch (1,326 bytes)   
From e4a4b2ae8b70aba68d6858a351552da0655ab8b7 Mon Sep 17 00:00:00 2001
From: Alexander Monakov <amonakov@ispras.ru>
Date: Mon, 7 Aug 2023 18:18:13 +0300
Subject: [PATCH] seccomp: remove prctl(PR_SET_DUMPABLE) snake oil

Making the process "not dumpable" has the following effects:

* core dumps are not produced
* ptrace-attaching to this process is disallowed
* files in /proc/<pid> become owned by root

Hence, it doesn't contribute to seccomp's goal of preventing attacks via
a hijacked 'file' process, and instead limits the ability to observe a
running (or crashing) 'file' program, which is not a goal here.
---
 src/seccomp.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/seccomp.c b/src/seccomp.c
index 87d4c49e..26bcbed4 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -68,9 +68,6 @@ enable_sandbox_basic(void)
 	if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
 		return -1;
 
-	if (prctl(PR_SET_DUMPABLE, 0, 0, 0, 0) == -1)
-		return -1;
-
 	// initialize the filter
 	ctx = seccomp_init(SCMP_ACT_ALLOW);
 	if (ctx == NULL)
@@ -158,9 +155,6 @@ enable_sandbox_full(void)
 	if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
 		return -1;
 
-	if (prctl(PR_SET_DUMPABLE, 0, 0, 0, 0) == -1)
-		return -1;
-
 	// initialize the filter
 	ctx = seccomp_init(SCMP_ACT_KILL);
 	if (ctx == NULL)
-- 
2.32.0

christos

2024-02-04 20:04

manager   ~0004003

Disabled.

Issue History

Date Modified Username Field Change
2023-08-07 16:21 amonakov New Issue
2023-08-07 16:21 amonakov File Added: 0001-seccomp-remove-prctl-PR_SET_DUMPABLE-snake-oil.patch
2024-02-04 20:04 christos Assigned To => christos
2024-02-04 20:04 christos Status new => assigned
2024-02-04 20:04 christos Status assigned => resolved
2024-02-04 20:04 christos Resolution open => fixed
2024-02-04 20:04 christos Fixed in Version => HEAD
2024-02-04 20:04 christos Note Added: 0004003