Skip to contentSkip to conversation

Ptrace hole / Linux 2.2.25

DISCUSSION [email protected] 1 participant 1 message Mar 19, 2003 ptrace support

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines · Alan Cox

Vulnerability: CAN-2003-0127

The Linux 2.2 and Linux 2.4 kernels have a flaw in ptrace. This hole allows local users to obtain full privileges. Remote exploitation of this hole is not possible. Linux 2.5 is not believed to be vulnerable.

The patch breaks /proc/<pid>/cmdline and /proc/<pid>/environ for 'non dumpable' processes, even for root.

We need to access theses proc files for processes monitoring.

Included is a patch to restore this functionnality for root.

Any comments ?
(See attached file: cmdline_environ_fix.diff)
--
Mathieu Lafon - Arkoon Network Security

kernel/ptrace.c +1 -1
diff -u -r1.3.24.1 ptrace.c
@@ -140,7 +140,7 @@
 	/* Worry about races with exit() */
 	task_lock(tsk);
 	mm = tsk->mm;
-	if (!is_dumpable(tsk) || (&init_mm == mm))
+	if ((!is_dumpable(tsk) || (&init_mm == mm)) && (current->uid != 0))
 		mm = NULL;
 	if (mm)
 		atomic_inc(&mm->mm_users);