输入错误密码时为什么会有延迟?

当输入正确的密码时,应用程序或操作系统(没有特定的应用程序,几乎无处不在)立即接受,但输入错误的密码时会有1-2秒的轻微延迟。 这是为什么?

延迟是减缓自动化软件的破解尝试。 没有延迟破解尝试会跑得快得多。

文档:请参阅man pam_fail_delay

基本原理

It is often possible to attack an authentication scheme by exploiting the time it takes the scheme to deny access to an applicant user. In cases of short timeouts, it may prove possible to attempt a brute force dictionary attack -- with an automated process, the attacker tries all possible passwords to gain access to the system. In other cases, where individual failures can take measurable amounts of time (indicating the nature of the failure), an attacker can obtain useful information about the authentication process. These latter attacks make use of procedural delays that constitute a covert channel of useful information. To minimize the effectiveness of such attacks, it is desirable to introduce a random delay in a failed authentication process. Preferable this value should be set by the application or a special PAM module. Standard PAM modules should not modify the delay unconditional.