今早到学校,打开ubuntu机器,发现桌面是空的.我记得很清楚前一天走的时候还在写程序,打开了很多窗口,怎么窗口自动关闭了呢?
马上打开用户管理,发现多了一个nobody5的帐户.在application里也多了一个zenmap的扫描器.一部小心我成了别人肉鸡和跳板,汗~
然后我决定把nobody5找出来:
1 断网线
2 查看未知帐号"grep :0: /etc/passwd",发现多了一个管理员用户nobody5.
root:x:0:0:root:/root:/bin/bash
nobody5:x:0:1002:SunOS 5.x Nobody:/tmp:/bin/bash
3 "last -a"查找所有登录过的用户,看到了这厮~worldserver.net的ip显示是德国~
nobody5 pts/5 Tue Oct 13 19:14 – 21:15 (02:00) vz275.worldserver.net
nobody5 pts/4 Tue Oct 13 17:09 – 19:42 (02:33) vz275.worldserver.net
nobody5 pts/3 Tue Oct 13 16:17 – 19:40 (03:23) vz275.worldserver.net
4 在用户管理器里修改nobody5的密码,然后用nobody5的帐号登陆,看看他干过什么."histroy"查看,动作很利落,没有什么多余的命令,注释如下:
1 df -h //查看磁盘使用情况
2 cat /proc/version //查看系统版本信息
3 cd ~
6 ls -la //查看我的目录
7 ifconfig -a //查看ip信息
8 find / -name .bashrc //查看有几个bashrc,应该是看用户情况
9 find / -name .bash_history
10 vi /home/ppa/.bash_history //查看我输入过什么命令
11 env //系统环境便量
12 cat /etc/shadow //用户信息
14 pwd //当前路径
16 wget http://mirrors.kernel.org/debian-cd/5.0.3/i386/iso-cd/debian-503-i386-CD-31.iso //下了个镜像
18 rm debian-503-i386-CD-31.iso //把刚下的东西删了,估计nobody5觉得这个没用
19 apt-get install nmap //装nmap
23 nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //开始扫描和我同网段的机器
28 wget http://nmap.org/svn/scripts/smb-check-vulns.nse //装上一个加强版的脚本
29 nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //再扫一遍
36 rm temp //完事擦屁屁
58 nmap -PN -T4 -p445 -n -v args=unsafe=1 –script smb-check-vulns,smb-os-discovery 129.59.0.0/16>>temp //胡汉山又回来了
59 apt-get remove nmap //二擦屁屁
60 rm -rf /usr/share/nmap //三擦屁屁
71 cd mail //看我的邮件
78 wget http://nmap.org/dist/nmap-5.00.tar.bz2 //下载一个最新版的nmap
79 bzip2 -cd nmap-5.00.tar.bz2 | tar xvf – //解压缩
80 cd nmap-5.00
81 ./configure
82 make
83 make install
85 find / -name nmap
86 /usr/local/bin/nmap //装上了namp
89 /usr/local/bin/nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //扫描同网机器
90 /usr/local/bin/nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery 160.129.0.0/16>>temp2 //5555~我成了跳板
91 cd /var/tmp/nmap-5.00
94 tail -f temp | grep vul //看看谁的机器还有漏洞
110 cat temp | grep -B 12 VULN
460 wget http://iroffer.dinoex.net/iroffer-dinoex-3.15.tar.gz //装iroffer
5 修补漏洞:
a 改一个强壮的本机密码
b “userdel -r newuser”删除帐户(用户管理里删除不了管理员帐户)
c 重启机器发现无法从图形界面里登录了,显示错误“/etc/gdm/Xsession: Beginning session setup… mkdtemp: private socket dir: Permission denied.”,估计是和删除管理员帐户有关.幸好还能通过ssh远程登录,修改"/tmp"的权限:“chmod a+w /tmp”,搞定~
4 卸载namp
5 关闭ftp服务。虽然我的ftp已经换了端口,保险起见,还是先关了~
将"etc/rc5.d/S20vsftpd"改名成"K20vsftpd"
6 限制访问本机的ip:
在/etc/hosts.allow中添加允许的ip或者网段
ALL:192.168.1.2:allow 或者
ALL:192.168.1.0/24:allow
在/etc/hosts.deny添加不允许ssh登陆的IP
ALL: ALL@ALL, PARANOID
7 关闭ipp
sudo /etc/init.d/cupsys stop
sudo update-rc.d -f cupsys remove
8 设置ping,icmp和其他
a in ubuntu ping can be disable by adding following line to /etc/init.d/networking (network init script)
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
b in 8.04.1 /etc/sysctl.conf add:
# Ignore ICMP broadcasts
net/ipv4/icmp_echo_ignore_broadcasts = 1
#
# Ignore bogus ICMP errors
net/ipv4/icmp_ignore_bogus_error_responses = 1
#
# Do not accept ICMP redirects (prevent MITM attacks)
net/ipv4/conf/all/accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
net/ipv4/conf/all/secure_redirects = 0
#
# Do not send ICMP redirects (we are not a router)
net/ipv4/conf/all/send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
net/ipv4/conf/all/accept_source_route = 0
also add to /etc/ufw/sysctl.conf:
#Ignorar Broadcast.
net/ipv4/icmp_echo_ignore_broadcasts=1
#Ignorar pings.
net/ipv4/icmp_echo_ignore_all=1
#No responder a paquetes icmp defectuosos.
net/ipv4/icmp_ignore_bogus_error_responses=1
ps:现在用"netstat -a -t"查看,只剩下ssh, vnc的端口还在使用,ping主机没反应,很完美~应该能清静一会了~
ps2:安装chkrootkit又查了一遍,确保没有留下后门,这次真的该清静了~
然后我决定把nobody5找出来:
1 断网线
2 查看未知帐号"grep :0: /etc/passwd",发现多了一个管理员用户nobody5.
root:x:0:0:root:/root:/bin/bash
nobody5:x:0:1002:SunOS 5.x Nobody:/tmp:/bin/bash
3 "last -a"查找所有登录过的用户,看到了这厮~worldserver.net的ip显示是德国~
nobody5 pts/5 Tue Oct 13 19:14 – 21:15 (02:00) vz275.worldserver.net
nobody5 pts/4 Tue Oct 13 17:09 – 19:42 (02:33) vz275.worldserver.net
nobody5 pts/3 Tue Oct 13 16:17 – 19:40 (03:23) vz275.worldserver.net
4 在用户管理器里修改nobody5的密码,然后用nobody5的帐号登陆,看看他干过什么."histroy"查看,动作很利落,没有什么多余的命令,注释如下:
1 df -h //查看磁盘使用情况
2 cat /proc/version //查看系统版本信息
3 cd ~
6 ls -la //查看我的目录
7 ifconfig -a //查看ip信息
8 find / -name .bashrc //查看有几个bashrc,应该是看用户情况
9 find / -name .bash_history
10 vi /home/ppa/.bash_history //查看我输入过什么命令
11 env //系统环境便量
12 cat /etc/shadow //用户信息
14 pwd //当前路径
16 wget http://mirrors.kernel.org/debian-cd/5.0.3/i386/iso-cd/debian-503-i386-CD-31.iso //下了个镜像
18 rm debian-503-i386-CD-31.iso //把刚下的东西删了,估计nobody5觉得这个没用
19 apt-get install nmap //装nmap
23 nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //开始扫描和我同网段的机器
28 wget http://nmap.org/svn/scripts/smb-check-vulns.nse //装上一个加强版的脚本
29 nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //再扫一遍
36 rm temp //完事擦屁屁
58 nmap -PN -T4 -p445 -n -v args=unsafe=1 –script smb-check-vulns,smb-os-discovery 129.59.0.0/16>>temp //胡汉山又回来了
59 apt-get remove nmap //二擦屁屁
60 rm -rf /usr/share/nmap //三擦屁屁
71 cd mail //看我的邮件
78 wget http://nmap.org/dist/nmap-5.00.tar.bz2 //下载一个最新版的nmap
79 bzip2 -cd nmap-5.00.tar.bz2 | tar xvf – //解压缩
80 cd nmap-5.00
81 ./configure
82 make
83 make install
85 find / -name nmap
86 /usr/local/bin/nmap //装上了namp
89 /usr/local/bin/nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //扫描同网机器
90 /usr/local/bin/nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery 160.129.0.0/16>>temp2 //5555~我成了跳板
91 cd /var/tmp/nmap-5.00
94 tail -f temp | grep vul //看看谁的机器还有漏洞
110 cat temp | grep -B 12 VULN
460 wget http://iroffer.dinoex.net/iroffer-dinoex-3.15.tar.gz //装iroffer
5 修补漏洞:
a 改一个强壮的本机密码
b “userdel -r newuser”删除帐户(用户管理里删除不了管理员帐户)
c 重启机器发现无法从图形界面里登录了,显示错误“/etc/gdm/Xsession: Beginning session setup… mkdtemp: private socket dir: Permission denied.”,估计是和删除管理员帐户有关.幸好还能通过ssh远程登录,修改"/tmp"的权限:“chmod a+w /tmp”,搞定~
4 卸载namp
5 关闭ftp服务。虽然我的ftp已经换了端口,保险起见,还是先关了~
将"etc/rc5.d/S20vsftpd"改名成"K20vsftpd"
6 限制访问本机的ip:
在/etc/hosts.allow中添加允许的ip或者网段
ALL:192.168.1.2:allow 或者
ALL:192.168.1.0/24:allow
在/etc/hosts.deny添加不允许ssh登陆的IP
ALL: ALL@ALL, PARANOID
7 关闭ipp
sudo /etc/init.d/cupsys stop
sudo update-rc.d -f cupsys remove
8 设置ping,icmp和其他
a in ubuntu ping can be disable by adding following line to /etc/init.d/networking (network init script)
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
b in 8.04.1 /etc/sysctl.conf add:
# Ignore ICMP broadcasts
net/ipv4/icmp_echo_ignore_broadcasts = 1
#
# Ignore bogus ICMP errors
net/ipv4/icmp_ignore_bogus_error_responses = 1
#
# Do not accept ICMP redirects (prevent MITM attacks)
net/ipv4/conf/all/accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
net/ipv4/conf/all/secure_redirects = 0
#
# Do not send ICMP redirects (we are not a router)
net/ipv4/conf/all/send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
net/ipv4/conf/all/accept_source_route = 0
also add to /etc/ufw/sysctl.conf:
#Ignorar Broadcast.
net/ipv4/icmp_echo_ignore_broadcasts=1
#Ignorar pings.
net/ipv4/icmp_echo_ignore_all=1
#No responder a paquetes icmp defectuosos.
net/ipv4/icmp_ignore_bogus_error_responses=1
ps:现在用"netstat -a -t"查看,只剩下ssh, vnc的端口还在使用,ping主机没反应,很完美~应该能清静一会了~
ps2:安装chkrootkit又查了一遍,确保没有留下后门,这次真的该清静了~
Comments
Post a Comment
https://gengwg.blogspot.com/