All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Mimi Zohar <zohar@linux.ibm.com>,
	Igor Zhbanov <i.zhbanov@omprussia.ru>,
	Matthew Garrett <mjg59@google.com>,
	Kees Cook <keescook@chromium.org>,
	Casey Schaufler <casey@schaufler-ca.com>,
	Paul Moore <paul@paul-moore.com>,
	John Johansen <john.johansen@canonical.com>
Cc: 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 09:10:57 -0400	[thread overview]
Message-ID: <648f1a64-e95d-d929-62dc-06decaf5a14b@tycho.nsa.gov> (raw)
In-Reply-To: <1554292678.7309.47.camel@linux.ibm.com>

On 4/3/19 7:57 AM, Mimi Zohar wrote:
> On Fri, 2019-03-29 at 15:50 +0300, Igor Zhbanov wrote:
>> On 29.03.2019 15:28, Stephen Smalley wrote:
>>> On 3/29/19 6:59 AM, Mimi Zohar wrote:
>>>> [Cc'ing the LSM mailing list and others]
>>>>
>>>> On Fri, 2019-03-29 at 13:00 +0300, Igor Zhbanov wrote:
>>>>> Hi Mimi,On 28.03.2019 20:17, Mimi Zohar wrote:
>>>>
>>>>>> I just came across the grsecurity article on mprotect.[1]
>>>>>>    Has anyone looked at it? Would it make sense to make it a minor LSM?
>>>>>>
>>>>>> [1]https://pax.grsecurity.net/docs/mprotect.txt
>>>>>
>>>>> Interesting article. It is almost exactly of what I wanted to be
>>>>> implemented.
>>>>>
>>>>> If this minor LSM would be stackable to allow combining with e.g. SELinux
>>>>> then why not.
>>>>
>>>> Stacking shouldn't be a problem.  Other LSMs are already on the
>>>> mprotect hook.  Let's hear what others think.
>>>
>>> SELinux already provides a set of controls over executable mappings;
>>> see selinux_mmap_file and selinux_file_mprotect. Other major security
>>> modules may do likewise but I can't speak to that. Is there some gap
>>> you are trying to address that isn't already covered, or are you just
>>> trying to provide such restrictions without requiring one of the
>>> major modules?
>>
>> I want to be sure that no unsigned code page could be executed. So exploits
>> could only be of ROP kind and not being able to download any extra code
>> from their servers. That's why I found that disabling of anonymous executable
>> pages could be useful for that (as well as disabling of making executable
>> pages writable to modify already mapped code). In conjunction with IMA it
>> should guarantee that no untrusted code could be executed.
> 
> Let's separate the different types of attacks.  From an IMA
> perspective, memory attacks are out of scope.  That leaves mmap'ed
> files, possibly just mmap'ed shared files.  Currently IMA can be
> configured to verify a file's integrity, based on signatures, being
> mmap'ed execute.  Assuming that not all files opened require a file
> signature, a file could be mmap'ed read/write and later changed to
> execute to circumvent the mmap'ed execute signature requirement.  If
> the existing LSMs are able to prevent this sort of attack, we could
> just document this requirement.

I guess I don't understand why IMA isn't already being called from 
security_file_mprotect(). security_file_mprotect() could just call 
ima_file_mmap(vma->vm_file, prot) if all of the security hooks pass.

SELinux can be used to prevent unauthorized mprotect PROT_EXEC but it 
won't perform a measurement of the file if it is allowed by policy.

  reply	other threads:[~2019-04-03 13:16 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
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 [this message]
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=648f1a64-e95d-d929-62dc-06decaf5a14b@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=casey@schaufler-ca.com \
    --cc=i.zhbanov@omprussia.ru \
    --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=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.