All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Mosnacek <omosnace@redhat.com>
To: Paul Moore <paul@paul-moore.com>
Cc: Linux-Audit Mailing List <linux-audit@redhat.com>
Subject: Re: [PATCH ghak95] audit: Do not log full CWD path on empty relative paths
Date: Tue, 13 Nov 2018 16:25:39 +0100	[thread overview]
Message-ID: <CAFqZXNspTPnpTeLfFou+RUwb5NZEgUWm9k8FdpJovTOh=Mfe4Q@mail.gmail.com> (raw)
In-Reply-To: <CAHC9VhRgBvc=Ec2ekT3mb8N4DcFV+xAPN_XDRmYGTmqCuK0ymw@mail.gmail.com>

On Tue, Nov 6, 2018 at 9:19 PM Paul Moore <paul@paul-moore.com> wrote:
> On Tue, Nov 6, 2018 at 3:09 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> > On Tue, Nov 6, 2018 at 12:30 AM Paul Moore <paul@paul-moore.com> wrote:
> > > Let's reset this discussion a bit ... if we abolish relative paths and
> > > make everything absolute, is there even a need to log PARENT?
> >
> > If there ever was such need, then this won't change when we switch to
> > absolute paths. The PATH records contain some fields (inode, dev, obj,
> > ...) that can be different for the child and parent and I would say
> > these are the only new information that the PARENT records provide
> > over the corresponding CREATE/DELETE records.
>
> Sigh.  Of course the inode information is going to be different
> between the object in question and the parent, they are different
> filesystem objects.  Ask your self the bigger question: does the
> PARENT record provide me any security relevant information related to
> the filesystem object that is being accessed?

I would say it does. Consider e.g. the "mode" and "obj" fields. When
you move (rename) a file from one directory to another (which is the
main, if not the only, case when a PARENT record is emitted), then you
are usually more interested in the values for the parent directory
than the file itself (that's what determines if you can move the
file).

For example, assume you have a rule that logs whenever some sensitive
file gets moved. You do not expect that to happen because you set the
file/directory permissions and labels so that it can't be done by
anyone unauthorized. But something goes wrong, the permissions/labels
get changed somehow and a bad actor leverages the situation to move
the file. Then later you want to investigate this security incident
and as part of it you want to know what permissions were set on the
directories involved that had allowed the file to be moved, because
this may give you a useful lead. With PARENT records, you get such
information, without them you don't.

>
> With the messed up state of path name auditing, the PARENT records are
> useful when trying to recreate the full path used by the process to
> access a given filesystem object (transient as it may be, the path
> name can still be useful after the fact).  If we switch to always
> recording absolute path names, why do we care about recording the
> PARENT filesystem object at all (both the path and the inode
> information)?

I disagree with your assumption that the PARENT record somehow helps
to determine the full path of the (child) filesystem object, in the
sense that it provides more information than what is already contained
in the corresponding CREATE/DELETE record. (Please correct me if
that's not what you were trying to say.) When we log the paths as we
do now, you either get a relative path in both PARENT and
CREATE/DELETE records (the PARENT path just being one element shorter)
or you get a full path in both records (again both will be the same
except the PARENT path will have the last component stripped),
depending on whether the user passed a relative or absolute path to
the syscall [*]. If we switch to always logging full paths, we simply
eliminate the first case (both paths will be always absolute).

Whether we switch to always logging absolute paths or not, the value
of the "path" field of the PARENT record is somewhat redundant (but I
don't see that as a problem).

[*] Disregarding the occasional glitch of getting the (full) path of
current directory as PARENT path when the child path is relative with
just a single component, a.k.a. GHAK #95...

--
Ondrej Mosnacek <omosnace at redhat dot com>
Associate Software Engineer, Security Technologies
Red Hat, Inc.

  reply	other threads:[~2018-11-13 15:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02 11:44 [PATCH ghak95] audit: Do not log full CWD path on empty relative paths Ondrej Mosnacek
2018-08-02 13:29 ` Richard Guy Briggs
2018-08-02 22:24 ` Paul Moore
2018-08-03  7:08   ` Ondrej Mosnacek
2018-08-24 14:09     ` Paul Moore
2018-08-27 13:00       ` Ondrej Mosnacek
2018-09-13 13:57         ` Ondrej Mosnacek
2018-09-13 14:13           ` Paul Moore
2018-09-19  1:35             ` Paul Moore
2018-09-19 11:01               ` Ondrej Mosnacek
2018-09-19 15:44                 ` Paul Moore
2018-10-31  8:54                   ` Ondrej Mosnacek
2018-11-05 23:30                     ` Paul Moore
2018-11-06  8:08                       ` Ondrej Mosnacek
2018-11-06 20:19                         ` Paul Moore
2018-11-13 15:25                           ` Ondrej Mosnacek [this message]
2018-11-13 16:30                             ` Paul Moore
2018-12-01 16:50                               ` Steve Grubb
2018-12-04  0:17                                 ` Paul Moore
2018-12-04  8:07                                 ` Ondrej Mosnacek
2018-12-04 22:19                                   ` Paul Moore
2018-08-03  0:03 ` Paul Moore
2018-08-24 15:00   ` Paul Moore
2018-08-24 15:14     ` Steve Grubb
2018-08-27 12:42       ` Ondrej Mosnacek
2018-08-24 12:59 ` Ondrej Mosnacek
2018-08-24 14:28   ` Steve Grubb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFqZXNspTPnpTeLfFou+RUwb5NZEgUWm9k8FdpJovTOh=Mfe4Q@mail.gmail.com' \
    --to=omosnace@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=paul@paul-moore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.