当输入正确的密码时,应用程序或操作系统(没有特定的应用程序,几乎所有地方都是如此)会立即接受,但当输入错误的密码时,会有 1-2 秒的短暂延迟。这是为什么呢?
答案1
延迟是为了减慢自动软件的破解尝试。如果没有延迟,破解尝试将运行得更快。
文档:参见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.