Home  >  Article  >  Backend Development  >  如何突破通过判断字符串相等的系统实现用户登录?

如何突破通过判断字符串相等的系统实现用户登录?

WBOY
WBOYOriginal
2016-06-06 20:39:11879browse

检测用户登录是账号密码是否匹配,可以通过判断字符串是否相等的方式。那如何突破这样的登录限制?

<code>php</code><code><?php $pw = "password";
$get = "password";
if($pw <> $get) {
    echo "login fail.";
} else {
    echo "login succeed.";
}
</code>

回复内容:

检测用户登录是账号密码是否匹配,可以通过判断字符串是否相等的方式。那如何突破这样的登录限制?

<code>php</code><code><?php $pw = "password";
$get = "password";
if($pw <> $get) {
    echo "login fail.";
} else {
    echo "login succeed.";
}
</code>

除非去暴力破解,或者侵入数据库直接修改数据。

通過記錄判斷相等所需要的時間,可以逐位確定密碼。

所以,下次請改用常數時間的相等比較算法。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn