当输入正确的密码时,应用程序或操作系统(没有特定的应用程序,几乎无处不在)会立即接受这一点,但是当输入错误的密码时,会有 1-2 秒的轻微延迟。这是为什么?
Pan*_*her 10
延迟是为了减缓自动化软件的破解尝试。立即破解尝试会运行得更快。
文档:参见man pam_fail_delay
基本原理
Run Code Online (Sandbox Code Playgroud)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.