Linux Hardening
 help / color / mirror / Atom feed
* Re: [PATCH v2 09/25] tcp: authopt: Disable via sysctl by default
       [not found]   ` <019e96b5-4047-6458-0cfa-c9ef8f0d0470@gmail.com>
@ 2021-11-05  8:50     ` Leonard Crestez
  0 siblings, 0 replies; only message in thread
From: Leonard Crestez @ 2021-11-05  8:50 UTC (permalink / raw)
  To: David Ahern, Dmitry Safonov, Eric Dumazet
  Cc: David S. Miller, Herbert Xu, Kuniyuki Iwashima, Hideaki YOSHIFUJI,
	Jakub Kicinski, Yuchung Cheng, Francesco Ruggeri, Mat Martineau,
	Christoph Paasch, Ivan Delalande, Priyaranjan Jha, netdev,
	linux-crypto, linux-kselftest, linux-kernel, Shuah Khan,
	linux-hardening, Kees Cook

On 11/3/21 4:39 AM, David Ahern wrote:
> On 11/1/21 10:34 AM, Leonard Crestez wrote:
>> diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
>> index 97eb54774924..cc34de6e4817 100644
>> --- a/net/ipv4/sysctl_net_ipv4.c
>> +++ b/net/ipv4/sysctl_net_ipv4.c
>> @@ -17,10 +17,11 @@
>>   #include <net/udp.h>
>>   #include <net/cipso_ipv4.h>
>>   #include <net/ping.h>
>>   #include <net/protocol.h>
>>   #include <net/netevent.h>
>> +#include <net/tcp_authopt.h>
>>   
>>   static int two = 2;
>>   static int three __maybe_unused = 3;
>>   static int four = 4;
>>   static int thousand = 1000;
>> @@ -583,10 +584,19 @@ static struct ctl_table ipv4_table[] = {
>>   		.mode		= 0644,
>>   		.proc_handler	= proc_douintvec_minmax,
>>   		.extra1		= &sysctl_fib_sync_mem_min,
>>   		.extra2		= &sysctl_fib_sync_mem_max,
>>   	},
>> +#ifdef CONFIG_TCP_AUTHOPT
>> +	{
>> +		.procname	= "tcp_authopt",
>> +		.data		= &sysctl_tcp_authopt,
>> +		.maxlen		= sizeof(int),
>> +		.mode		= 0644,
>> +		.proc_handler	= proc_dointvec,
> 
> Just add it to the namespace set, and this could be a u8 (try to plug a
> hole if possible) with min/max specified:
> 
>                  .maxlen         = sizeof(u8),
>                  .mode           = 0644,
>                  .extra1         = SYSCTL_ZERO,
>                  .extra2         = SYSCTL_ONE
> 
> 
> see icmp_echo_enable_probe as an example. And if you are not going to
> clean up when toggled off, you need a handler that tells the user it can
> not be disabled by erroring out on attempts to disable it.

This is deliberately per-system because the goal is to avoid possible 
local privilege escalations by reducing the attack surface. Even the 
smallest flaw could be exploited by a malicious application establishing 
an authenticated connection on loopback.

Applications running in containers frequently have full access to 
sysctls so making this per-namespace would defeat the original purpose. 
I can't think of any reason to prevent using this feature at the 
namespace level, it has no interesting effects outside TCP connections 
for which it is enabled.

I also believe that as similar sysctl would be useful for TCP-MD5.

You're right about adding additional prints.

--
Regards,
Leonard

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-05  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1635784253.git.cdleonard@gmail.com>
     [not found] ` <137399b962131c278acbfa5446a3b6d59aa0547b.1635784253.git.cdleonard@gmail.com>
     [not found]   ` <019e96b5-4047-6458-0cfa-c9ef8f0d0470@gmail.com>
2021-11-05  8:50     ` [PATCH v2 09/25] tcp: authopt: Disable via sysctl by default Leonard Crestez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox