All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Zhbanov <i.zhbanov@omprussia.ru>
To: Matthew Garrett <mjg59@google.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>,
	Mimi Zohar <zohar@linux.ibm.com>,
	Kees Cook <keescook@chromium.org>,
	Casey Schaufler <casey@schaufler-ca.com>,
	Paul Moore <paul@paul-moore.com>,
	John Johansen <john.johansen@canonical.com>,
	linux-integrity <linux-integrity@vger.kernel.org>,
	Jann Horn <jannh@google.com>,
	linux-security-module <linux-security-module@vger.kernel.org>
Subject: Re: Should mprotect(..., PROT_EXEC) be checked by IMA?
Date: Wed, 3 Apr 2019 20:31:23 +0300	[thread overview]
Message-ID: <bca4eb5b-2d76-5df8-6e63-573b3a057985@omprussia.ru> (raw)
In-Reply-To: <CACdnJusgwpcSxzwNEieqsa54_3cTYMEfuXpAeP0cW81TQ29E+w@mail.gmail.com>

On 03.04.2019 19:58, Matthew Garrett wrote:
> On Wed, Apr 3, 2019 at 2:59 AM Igor Zhbanov <i.zhbanov@omprussia.ru> wrote:
> No, that's my point - if you're able to pass code directly to the
> interpreter then you're not protected by file signatures. python -c
> 'print("hello")' will execute without the user-provided code touching
> IMA.
> 
>> And having this feature as a per-process you could still limit the attack
>> surface by restricting e.g. network services as they are constantly attacked.
>>
>> So are you saying that this feature doesn't worth to make it?
> 
> I'm saying that before adding more security code you should describe
> the attack that you're actually trying to prevent. What you're doing
> prevents applications from opening a file read-only and then
> mprotect()ing it to being executable without IMA noticing, but what
> attack are you actually protecting against as a result? You block one
> avenue of obtaining code execution that isn't measured by IMA, but
> there are many more. Most (but not all) are blocked by requiring that
> all files be signed, but if all files are signed we don't need to
> change the behaviour here - opening the file read-only will be enough
> to trigger an appraisal.

I'm trying to reduce attacker's possibilities to inject any new unauthorized
code. Currently it could be:
1) Downloaded binaries (on disk) which is validated by IMA,

2) Downloaded scripts (which need some combined approach like removing
    unneeded interpreters and checking the they are open and disabling passing
    the script as command line argument),

3) Return-Oriented-Programming exploits. Compiler support for validating
    return addresses is needed.

4) Anonymous executable pages (either new or existing changing to writable).
    ^ This is what I'm talking about. Because it's relatively easy to create
    anonymous executable page to stay below the radar. Because even if you
    enable signature checking for all opened files it would be possible to
    simply download the code and execute it directly from the anonymous pages.

By closing one by one these possibilities one can be (relatively) sure that
only trusted code and scripts could be executed.

  reply	other threads:[~2019-04-03 17:31 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 15:18 Should mprotect(..., PROT_EXEC) be checked by IMA? Igor Zhbanov
2019-03-18 21:48 ` Mimi Zohar
2019-03-19  7:50   ` Igor Zhbanov
2019-03-19 11:22     ` Mimi Zohar
2019-03-19 12:19       ` Igor Zhbanov
2019-03-19 17:05         ` Mimi Zohar
2019-03-20  8:11           ` Igor Zhbanov
2019-03-20 17:23             ` Matthew Garrett
2019-03-20 18:08               ` Igor Zhbanov
2019-03-21 11:21               ` Mimi Zohar
2019-03-21 11:48                 ` Igor Zhbanov
2019-03-21 18:04                   ` Matthew Garrett
2019-03-22  7:59                     ` Igor Zhbanov
2019-03-28 17:17                       ` Mimi Zohar
2019-03-29 10:00                         ` Igor Zhbanov
2019-03-29 10:59                           ` Mimi Zohar
2019-03-29 11:51                             ` Jordan Glover
2019-03-29 12:28                             ` Stephen Smalley
2019-03-29 12:50                               ` Igor Zhbanov
2019-04-02 22:31                                 ` Matthew Garrett
2019-04-03  9:59                                   ` Igor Zhbanov
2019-04-03 16:58                                     ` Matthew Garrett
2019-04-03 17:31                                       ` Igor Zhbanov [this message]
2019-04-03 18:19                                         ` Matthew Garrett
2019-04-03 18:47                                           ` Igor Zhbanov
2019-04-03 19:25                                             ` Matthew Garrett
2019-04-04 11:44                                               ` Igor Zhbanov
2019-04-03 12:11                                   ` Mimi Zohar
2019-04-03 13:18                                     ` Perez Yves-Alexis
2019-04-03 11:57                                 ` Mimi Zohar
2019-04-03 13:10                                   ` Stephen Smalley
2019-04-03 14:33                                     ` Mimi Zohar
2019-04-03 14:33                                       ` Stephen Smalley
2019-04-03 16:21                                         ` Mimi Zohar
2019-03-21 18:13                 ` Matthew Garrett
2019-03-19 17:07         ` Matthew Garrett

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=bca4eb5b-2d76-5df8-6e63-573b3a057985@omprussia.ru \
    --to=i.zhbanov@omprussia.ru \
    --cc=casey@schaufler-ca.com \
    --cc=jannh@google.com \
    --cc=john.johansen@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mjg59@google.com \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=zohar@linux.ibm.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.