MySQL服务端读取客户端的漏洞

一个adminer如下


看到这个页面尝试弱口令登陆无果,想起了前段时间做的MySQL服务端读取客户端的漏洞
poc: https://github.com/allyshka/Rogue-MySql-Server

在服务端监听后,使用adminer连接服务端


起初读/etc/passwd ,报错显示为opendir的关系,于是读取web文件,


于是读取 /data01/htdocs/m.php文件成功读取
由于已经发现有config.php,于是读取config.php 发现mysql配置文件,得到mysql账号名和密码
====================================================================

要支持命令load data local infile,应当在/etc/mysql/my.cnf中添加这样的设置:
 
[plain]  view plain  copy
 
  1. [mysqld]        #服务端配置  
  2. local-infle = 1  
  3.   
  4. [mysql]         #客户端配置  
  5. local-infile = 1  
 
否则,mysql服务会提示错误:
ERROR 1148 (42000): The used command is not allowed with this MySQL version.
 
-------------------------------
另外,如果使用了python来运行的话,应该这样连接:
conn = MySQLdb.connect(host=host_str , user=user_str , passwd=pwd_str , db=db_str , local_infile=1,charset=charset_str)

猜你喜欢

转载自www.cnblogs.com/anbuxuan/p/11824456.html