Modify core dump flags of running suid-binaries:
Since proc is also writeable, the same technique can be used to
modify open proc files, e.g. adjust the coredump filter of a currently
running
passwd program
(
ModifyCoreDumpFilter.sh):
#!/bin/bash
echo "Current pid is $$"
(sleep 10; echo 127 ) > /proc/$$/coredump_filter &
sleep 5
exec /usr/bin/passwd
Some open proc files can only be written by the process itself, e.g.
/proc/[pid]/mem, a limitation that could be circumvented if
any suid-binary echos out command line/input file/environment data,
e.g.
sudoedit -p xxx /etc/sudoers echos
xxx. If
/procc/[pid]/mem would be writeable on standard linux kernels,
this program should give local root privilege escalation
(
SeekHelper.c), e.g.
./SeekHelper /proc/self/mem 8048000 /usr/bin/sudoedit -p xxx /etc/sudoers
with a crafted address and promt payload. Currently something
else is still blocking in kernel, could be
fs/proc/base.c:
static ssize_t mem_read(struct file * file, char __user * buf,
size_t count, loff_t *ppos) {
...
if (file->private_data != (void*)((long)current->self_exec_id))
goto out_put;
Inject faults using oom_adjust:
Some programs, e.g. from the
shadow suite, try to disable
all signals and limits to assure that critical code is not
interrupted, e.g. modification of
/etc/shadow when a
unprivileged user changes his password. Since this program
creates a lock file, interruption via oom_kill could leave
stale lockfiles and so impede functionality.
test@localhost:~/Tasks/LowMemoryProgramCrashing$ cat OomRun.sh
#!/bin/bash
(sleep 3; echo 15) > /proc/$$/oom_adj &
exec /usr/bin/passwd
Last modified 20110704
Contact e-mail: me (%) halfdog.net