Hi,
On Tue, Mar 09, 2021 at 07:40:54PM +0100, John Wood wrote:
On Sun, Mar 07, 2021 at 02:49:27PM -0800, Andi Kleen wrote:
So I think it needs more work on the user space side for most usages.
Anyway, in the case that the supervisor is init then the system will panic. So, I think that we can add a prctl to avoid kill the parent task (the task that exec) and only block new fork system calls from this task. When this boolean is set, any parent task that is involved in the attack will not be killed. In this case, any following forks will be blocked. This way the system will not crash.
Another proposal that I think suits better:
When a brute force attack is detected through the fork or execve system call, all the tasks involved in the attack will be killed with the exception of the init task (task with pid equal to zero). Now, and only if the init task is involved in the attack, block the fork system call from the init process during a user defined time (using a sysctl attribute). This way the brute force attack is mitigated and the system does not panic.
I think that this is a better solution than the other one since this is a per system solution. And I believe that with a default value for the blocking time (sysctl attribute) could be useful in a generic way (for most usages).
The proposal using prctl will need more actions from userspace and it is not a generic one due to it is a per process solution.
What do you think?
Thanks, John Wood