时间:2021-07-01 10:21:17 帮助过:2人阅读
某个网站的登录验证的SQL查询代码为:
1 | strSQL = "SELECT * FROM users WHERE (name = ‘" + userName + "‘) and (pw = ‘" + passWord + "‘);" |
恶意填入
2 | userName = "1‘ OR ‘1‘=‘1" ; |
与
3 | passWord = "1‘ OR ‘1‘=‘1" ; |
时,将导致原本的SQL字符串被填为
4 | strSQL = "SELECT * FROM users WHERE (name = ‘1‘ OR ‘1‘=‘1‘) and (pw = ‘1‘ OR ‘1‘=‘1‘);" |
也就是实际上运行的SQL命令会变成下面这样的
5 | strSQL = "SELECT * FROM users;" |
因此达到无账号密码,亦可登录网站。所以SQL注入攻击被俗称为黑客的填空游戏。
sql注入代码解释
标签:6666