Re: [PATCH v5 7/8] Documentation: Add documentation for the Brute LSM

John Wood
2021-03-07T18:07:39Z

On Sun, Mar 07, 2021 at 09:25:40AM -0800, Andi Kleen wrote:
> > processes created from it will be killed. If the systemd restart the network
> > daemon and it will crash again, then the systemd will be killed. I think this
> > way the attack is fully mitigated.
>
> Wouldn't that panic the system? Killing init is usually a panic.

The mitigation acts only over the process that crashes (network daemon) and the
process that exec() it (systemd). This mitigation don't go up in the processes
tree until reach the init process.

Note: I am a kernel newbie and I don't know if the systemd is init. Sorry if it
is a stupid question. AFAIK systemd is not the init process (the first process
that is executed) but I am not sure.

>
> > > Or if it's a interactive login you log in again.
> >
> > First the login will be killed (if it fails with a fatal signal) and if it is
> > restarted, the process that exec() it again will be killed. In this case I think
> > that the threat is also completely mitigated.
>
> Okay so sshd will be killed. And if it gets restarted eventually init,
> so panic again.

In this scenario the process that exec() the login will be killed (sshd
process). But I think that sshd is not the init process. So no panic.

> That's a fairly drastic consequence because even without panic
> it means nobody can fix the system anymore without a console.

So, you suggest that the mitigation method for the brute force attack through
the execve system call should be different (not kill the process that exec).
Any suggestions would be welcome to improve this feature.

> So probably the mitigation means that most such attacks eventually lead
> to a panic because they will reach init sooner or later.

I think it is not correct. As explain earlier the current mitigation method only
works over the process that crashes and their parent. It not go up in the
processes tree until reach the init process.

> Another somewhat worrying case is some bug that kills KVM guests.
> So if the bug can be triggered frequently you can kill all the
> virtualization management infrastructure.

Well, we need to work to avoid false positives.

> I don't remember seeing a discussion of such drastic consequences in
> your description. It might be ok depending on the use case,
> but people certainly need to be aware of it.
>
> It's probably not something you want to have enabled by default ever.
>
> -Andi
>
Thanks,
John Wood