From: Randy Dunlap <rdunlap@infradead.org>
To: John Wood <john.wood@gmx.com>, Kees Cook <keescook@chromium.org>,
Jann Horn <jannh@google.com>, Jonathan Corbet <corbet@lwn.net>,
James Morris <jmorris@namei.org>, Shuah Khan <shuah@kernel.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v3 3/8] securtiy/brute: Detect a brute force attack
Date: Sun, 21 Feb 2021 18:30:10 -0800 [thread overview]
Message-ID: <4fde79a5-34fe-fd27-b390-e9fd341996fb@infradead.org> (raw)
In-Reply-To: <20210221154919.68050-4-john.wood@gmx.com>
Hi,
one spello in 2 locations:
On 2/21/21 7:49 AM, John Wood wrote:
> To detect a brute force attack it is necessary that the statistics
> shared by all the fork hierarchy processes be updated in every fatal
> crash and the most important data to update is the application crash
> period. To do so, use the new "task_fatal_signal" LSM hook added in a
> previous step.
>
> The application crash period must be a value that is not prone to change
> due to spurious data and follows the real crash period. So, to compute
> it, the exponential moving average (EMA) is used.
>
> There are two types of brute force attacks that need to be detected. The
> first one is an attack that happens through the fork system call and the
> second one is an attack that happens through the execve system call. The
> first type uses the statistics shared by all the fork hierarchy
> processes, but the second type cannot use this statistical data due to
> these statistics dissapear when the involved tasks finished. In this
disappear
> last scenario the attack info should be tracked by the statistics of a
> higher fork hierarchy (the hierarchy that contains the process that
> forks before the execve system call).
>
> Moreover, these two attack types have two variants. A slow brute force
> attack that is detected if the maximum number of faults per fork
> hierarchy is reached and a fast brute force attack that is detected if
> the application crash period falls below a certain threshold.
>
> Also, this patch adds locking to protect the statistics pointer hold by
> every process.
>
> Signed-off-by: John Wood <john.wood@gmx.com>
> ---
> security/brute/brute.c | 488 +++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 474 insertions(+), 14 deletions(-)
>
> diff --git a/security/brute/brute.c b/security/brute/brute.c
> index 70f812bb7763..645bd6e02638 100644
> --- a/security/brute/brute.c
> +++ b/security/brute/brute.c
> +/**
> + * brute_get_exec_stats() - Get the exec statistics.
> + * @stats: When this function is called, this parameter must point to the
> + * current process' statistical data. When this function returns, this
> + * parameter points to the parent process' statistics of the fork
> + * hierarchy that hold the current process' statistics.
> + *
> + * To manage a brute force attack that happens through the execve system call it
> + * is not possible to use the statistical data hold by this process due to these
> + * statistics dissapear when this task is finished. In this scenario this data
disappear
> + * should be tracked by the statistics of a higher fork hierarchy (the hierarchy
> + * that contains the process that forks before the execve system call).
> + *
> + * To find these statistics the current fork hierarchy must be traversed up
> + * until new statistics are found.
> + *
> + * Context: Must be called with tasklist_lock and brute_stats_ptr_lock held.
> + */
> +static void brute_get_exec_stats(struct brute_stats **stats)
> +{
--
~Randy
next prev parent reply other threads:[~2021-02-22 2:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-21 15:49 [PATCH v3 0/8] Fork brute force attack mitigation John Wood
2021-02-21 15:49 ` [PATCH v3 1/8] security: Add LSM hook at the point where a task gets a fatal signal John Wood
2021-02-21 15:49 ` [PATCH v3 2/8] security/brute: Define a LSM and manage statistical data John Wood
2021-02-21 15:49 ` [PATCH v3 3/8] securtiy/brute: Detect a brute force attack John Wood
2021-02-22 2:25 ` Randy Dunlap
2021-02-23 18:13 ` John Wood
2021-02-22 2:30 ` Randy Dunlap [this message]
2021-02-23 18:25 ` John Wood
2021-02-22 2:47 ` Randy Dunlap
2021-02-23 18:20 ` John Wood
2021-02-23 20:44 ` Randy Dunlap
2021-02-21 15:49 ` [PATCH v3 4/8] security/brute: Fine tuning the attack detection John Wood
2021-02-21 15:49 ` [PATCH v3 5/8] security/brute: Mitigate a brute force attack John Wood
2021-02-21 15:49 ` [PATCH v3 6/8] selftests/brute: Add tests for the Brute LSM John Wood
2021-02-21 15:49 ` [PATCH v3 7/8] Documentation: Add documentation " John Wood
2021-02-21 15:49 ` [PATCH v3 8/8] MAINTAINERS: Add a new entry " John Wood
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=4fde79a5-34fe-fd27-b390-e9fd341996fb@infradead.org \
--to=rdunlap@infradead.org \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=jmorris@namei.org \
--cc=john.wood@gmx.com \
--cc=keescook@chromium.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=shuah@kernel.org \
/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).