[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240619.wii8Chaesh7t@digikod.net>
Date: Wed, 19 Jun 2024 14:20:58 +0200
From: Mickaël Salaün <mic@...ikod.net>
To: Ivanov Mikhail <ivanov.mikhail1@...wei-partners.com>
Cc: willemdebruijn.kernel@...il.com, gnoack3000@...il.com,
linux-security-module@...r.kernel.org, netdev@...r.kernel.org, netfilter-devel@...r.kernel.org,
yusongping@...wei.com, artem.kuzin@...wei.com, konstantin.meskhidze@...wei.com,
Günther Noack <gnoack@...gle.com>
Subject: Re: [PATCH 0/2] Forbid illegitimate binding via listen(2)
Could you please send a v2 for this patch? I'd like this issue to be
fixed, especially before any other Landlock feature get merged.
On Mon, Apr 08, 2024 at 05:47:45PM +0800, Ivanov Mikhail wrote:
> listen(2) can be called without explicit bind(2) call. For a TCP socket
> it would result in assigning random port(in some range) to this socket
> by the kernel. If Landlock sandbox supports LANDLOCK_ACCESS_NET_BIND_TCP,
> this may lead to implicit access to a prohibited (by Landlock sandbox)
> port. Malicious sandboxed process can accidentally impersonate a
> legitimate server process (if listen(2) assigns it a server port number).
>
> Patch adds hook on socket_listen() that prevents such scenario by checking
> LANDLOCK_ACCESS_NET_BIND_TCP access for port 0.
>
> Few tests were added to cover this case.
>
> Code coverage(gcov):
> * security/landlock:
> lines......: 94.5% (745 of 788 lines)
> functions..: 97.1% (100 of 103 functions)
>
> Ivanov Mikhail (2):
> landlock: Add hook on socket_listen()
> selftests/landlock: Create 'listen_zero', 'deny_listen_zero' tests
>
> security/landlock/net.c | 104 +++++++++++++++++---
> tools/testing/selftests/landlock/net_test.c | 89 +++++++++++++++++
> 2 files changed, 177 insertions(+), 16 deletions(-)
>
> --
> 2.34.1
>
>
Powered by blists - more mailing lists