public inbox for kernel-hardening@lists.openwall.com
 help / color / mirror / Atom feed
* [kernel-hardening] /proc/PID directory hiding (was: [owl-dev] segoon's status report - #1 of 15)
       [not found]     ` <4DE139FE.8050808@gmail.com>
@ 2011-06-04 18:19       ` Solar Designer
  2011-06-04 20:20         ` Vasiliy Kulikov
  0 siblings, 1 reply; 5+ messages in thread
From: Solar Designer @ 2011-06-04 18:19 UTC (permalink / raw)
  To: kernel-hardening; +Cc: Pavel Labushev

Pavel, Vasiliy -

On Sun, May 29, 2011 at 02:07:58AM +0800, Pavel Labushev wrote:
> 24.05.2011 23:12, Vasiliy Kulikov wrote:
> 
> > I've implemented restricted perms, but didn't do actual hiding
> > directories.  In grsecurity it is implemented by hiding directories from
> > processes that cannot access them.
> > 
> > I think it may be defective by design because there are many other ways
> 
> It is:
> $ python -c 'import os; print os.stat("/proc/1")'
> posix.stat_result(st_mode=16744, st_ino=535821L, st_dev=3L, st_nlink=6,
> st_uid=0, st_gid=0, st_size=0L, st_atime=1306605485, st_mtime=1306605485,
> st_ctime=1306605485)
> 
> It's a known flaw and AFAIR it was considered irrelevant.

Is the above on grsecurity?

I think we may choose to restrict more than just directory listing -
that is, have these entries invisible even when referenced by full
pathnames.

As to probing for PIDs with syscalls such as kill(2), we may deal with
that as well (but we'd need to consider potential performance impact, as
well as timing attacks), or may choose not to do it.  Arguably, we
primarily want to hide UIDs/GIDs of running processes, not their PIDs.

Alexander

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kernel-hardening] /proc/PID directory hiding (was: [owl-dev] segoon's status report - #1 of 15)
  2011-06-04 18:19       ` [kernel-hardening] /proc/PID directory hiding (was: [owl-dev] segoon's status report - #1 of 15) Solar Designer
@ 2011-06-04 20:20         ` Vasiliy Kulikov
  2011-06-04 21:03           ` Solar Designer
  2011-06-05  0:10           ` [kernel-hardening] /proc/PID directory hiding Pavel Labushev
  0 siblings, 2 replies; 5+ messages in thread
From: Vasiliy Kulikov @ 2011-06-04 20:20 UTC (permalink / raw)
  To: kernel-hardening; +Cc: Pavel Labushev

On Sat, Jun 04, 2011 at 22:19 +0400, Solar Designer wrote:
> > It is:
> > $ python -c 'import os; print os.stat("/proc/1")'
> > posix.stat_result(st_mode=16744, st_ino=535821L, st_dev=3L, st_nlink=6,
> > st_uid=0, st_gid=0, st_size=0L, st_atime=1306605485, st_mtime=1306605485,
> > st_ctime=1306605485)
> > 
> > It's a known flaw and AFAIR it was considered irrelevant.
> 
> Is the above on grsecurity?

No, grsecurity hides uid/gid from both *stat*(2) and getdents*(2) functions
(implemented as proc_pid_readdir() and pid_getattr()).

> As to probing for PIDs with syscalls such as kill(2), we may deal with
> that as well

I'd not do this.  There are too many paths using pids, I don't think
there is some universal way (read: a bottleneck) to filter all accesses.
And the award is not too high to bother.

Thanks,

Vasiliy.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kernel-hardening] /proc/PID directory hiding (was: [owl-dev] segoon's status report - #1 of 15)
  2011-06-04 20:20         ` Vasiliy Kulikov
@ 2011-06-04 21:03           ` Solar Designer
  2011-06-05  0:10           ` [kernel-hardening] /proc/PID directory hiding Pavel Labushev
  1 sibling, 0 replies; 5+ messages in thread
From: Solar Designer @ 2011-06-04 21:03 UTC (permalink / raw)
  To: kernel-hardening; +Cc: Pavel Labushev

On Sun, Jun 05, 2011 at 12:20:47AM +0400, Vasiliy Kulikov wrote:
> On Sat, Jun 04, 2011 at 22:19 +0400, Solar Designer wrote:
> > As to probing for PIDs with syscalls such as kill(2), we may deal with
> > that as well
> 
> I'd not do this.  There are too many paths using pids, I don't think
> there is some universal way (read: a bottleneck) to filter all accesses.

Something like this is done for containers, but I agree with you.

> And the award is not too high to bother.

Yes, perhaps, and it'd be difficult to avoid timing leaks.

Anyhow, this would be a separate task.  Let's deal with the filesystems
first, and then proceed with other hardening measures already
implemented in patches and needing proper submission upstream.

Alexander

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kernel-hardening] /proc/PID directory hiding
  2011-06-04 20:20         ` Vasiliy Kulikov
  2011-06-04 21:03           ` Solar Designer
@ 2011-06-05  0:10           ` Pavel Labushev
  2011-06-05  1:18             ` Pavel Labushev
  1 sibling, 1 reply; 5+ messages in thread
From: Pavel Labushev @ 2011-06-05  0:10 UTC (permalink / raw)
  To: kernel-hardening

05.06.2011 04:20, Vasiliy Kulikov пишет:

>> Is the above on grsecurity?
> 
> No, grsecurity hides uid/gid from both *stat*(2) and getdents*(2) functions
> (implemented as proc_pid_readdir() and pid_getattr()).

Yes, it's on grsecurity. Just try it and see.

$ uname -r
2.6.39-grsec
$ find /proc -maxdepth 1 -type d -name 1
$ ls -ld /proc/1
dr-xr-x--- 6 root root 0 Jun  4 21:05 /proc/1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kernel-hardening] /proc/PID directory hiding
  2011-06-05  0:10           ` [kernel-hardening] /proc/PID directory hiding Pavel Labushev
@ 2011-06-05  1:18             ` Pavel Labushev
  0 siblings, 0 replies; 5+ messages in thread
From: Pavel Labushev @ 2011-06-05  1:18 UTC (permalink / raw)
  To: kernel-hardening

>>> Is the above on grsecurity?
>>
>> No, grsecurity hides uid/gid from both *stat*(2) and getdents*(2) functions
>> (implemented as proc_pid_readdir() and pid_getattr()).
> 
> Yes, it's on grsecurity. Just try it and see.
> 
> $ uname -r
> 2.6.39-grsec
> $ find /proc -maxdepth 1 -type d -name 1
> $ ls -ld /proc/1
> dr-xr-x--- 6 root root 0 Jun  4 21:05 /proc/1

Fixed in the latest grsec patches.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-05  1:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20110518150601.GA2921@albatros>
     [not found] ` <20110524023409.GC12486@openwall.com>
     [not found]   ` <20110524151246.GA3401@albatros>
     [not found]     ` <4DE139FE.8050808@gmail.com>
2011-06-04 18:19       ` [kernel-hardening] /proc/PID directory hiding (was: [owl-dev] segoon's status report - #1 of 15) Solar Designer
2011-06-04 20:20         ` Vasiliy Kulikov
2011-06-04 21:03           ` Solar Designer
2011-06-05  0:10           ` [kernel-hardening] /proc/PID directory hiding Pavel Labushev
2011-06-05  1:18             ` Pavel Labushev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox