keyrings.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Andrey Ryabinin <arbn@yandex-team.ru>,
	David Howells <dhowells@redhat.com>
Cc: James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] keys: Allow disabling read permissions for key possessor
Date: Tue, 23 Mar 2021 04:02:15 +0200	[thread overview]
Message-ID: <YFlMJ12+3/MpYixW@kernel.org> (raw)
In-Reply-To: <20210322095726.14939-1-arbn@yandex-team.ru>

On Mon, Mar 22, 2021 at 12:57:26PM +0300, Andrey Ryabinin wrote:
> keyctl_read_key() has a strange code which allows possessor to read
> key's payload regardless of READ permission status:
> 
> $ keyctl add user test test @u
> 196773443
> $ keyctl print 196773443
> test
> $ keyctl describe 196773443
> 196773443: alswrv-----v------------  1000  1000 user: test
> $ keyctl rdescribe 196773443
> user;1000;1000;3f010000;test
> $ keyctl setperm 196773443 0x3d010000
> $ keyctl describe 196773443
> 196773443: alsw-v-----v------------  1000  1000 user: test
> $ keyctl  print 196773443
> test
> 
> The last keyctl print should fail with -EACCESS instead of success.
> Fix this by removing weird possessor checks.
> 
> Signed-off-by: Andrey Ryabinin <arbn@yandex-team.ru>

I wrote a new test. If you include a test into a commit please
describe it so that it can be easily executed. Otherwise, it is
somewhat useless.

Anyway,

https://gist.github.com/jarkk0sakkinen/7b417be20cb52ed971a90561192f0883

David, why all of these end up allowing to still print the payload?

/Jarkko

      parent reply	other threads:[~2021-03-23  2:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22  9:57 [PATCH] keys: Allow disabling read permissions for key possessor Andrey Ryabinin
2021-03-23  0:55 ` Eric Biggers
2021-03-23  2:02 ` Jarkko Sakkinen [this message]

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=YFlMJ12+3/MpYixW@kernel.org \
    --to=jarkko@kernel.org \
    --cc=arbn@yandex-team.ru \
    --cc=dhowells@redhat.com \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).