CVE-2021-20251 s3: Ensure bad password count atomic updates for SAMR AES password...
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 2 Aug 2022 02:43:19 +0000 (14:43 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 13 Sep 2022 00:08:07 +0000 (00:08 +0000)
commit8ae0c38d54f065915e927bbfe1b656400a79eb13
tree40c98a97c23f0c92cfe17c35a2a8bb36ad77c0da
parent1d869a2a666cfada1495d891021de6c2b8567a96
CVE-2021-20251 s3: Ensure bad password count atomic updates for SAMR AES password change

The bad password count is supposed to limit the number of failed login
attempt a user can make before being temporarily locked out, but race
conditions between processes have allowed determined attackers to make
many more than the specified number of attempts.  This is especially
bad on constrained or overcommitted hardware.

To fix this, once a bad password is detected, we reload the sam account
information under a user-specific mutex, ensuring we have an up to
date bad password count.

We also update the bad password count if the password is wrong, which we
did not previously do.

Derived from a similar patch to source3/auth/check_samsec.c by
Jeremy Allison <jra@samba.org>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14611

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Sep 13 00:08:07 UTC 2022 on sn-devel-184
source3/rpc_server/samr/srv_samr_nt.c