Monday, August 16, 2010

[教程] 检测局域网 conficker / smb / RPC vulnerability

过去一直为了 conficker 而烦, 烦恼着它一出现, 我宿舍的网络就差到......不行.
过去都是 'how to prevent conficker' 啦... 'how to remove conficker' 啦... 'block conficker' 啦...
我却忘了如何 'how to detect conficker in network', 就这样, 不小心为自己上了小小一课
从最基本的方法做起: 原文
就是使用 nmap 的 smb-check-vulns script
这个方法是检测 windows 某些致命漏洞如下
  • MS08-067, a Windows RPC vulnerability
  • Conficker, an infection by the Conficker worm
  • Unnamed regsvc DoS, a denial-of-service vulnerability I accidentally found in Windows 2000
  • SMBv2 exploit (CVE-2009-3103, Microsoft Security Advisory 975497)
  • MS06-025, a Windows Ras RPC service vulnerability
  • MS07-029, a Windows Dns Server RPC service vulnerability
我刚对宿舍的17台电脑(周末电脑好少)作了测试, 使用 nMap (windows / linux 通用)
"nmap -p 139,445 -v -n -PN --script smb-check-vulns --script-args unsafe=1 172.16.2.0/24"
-p 是要 scan 的 port, 所以我们须要知道那些 port 的定义, 139 是 netbios 然后 445
是 samba related connection. File sharing用的
-v 这个我不懂要怎样解释, 据我所知道的是, 如果 -v 用得越多(-v -v -v -v), 有些 IDS 是检测不到你的 nmap scan connection. 但现在新一代的我就不清楚了, 还没试过.
-n 是免去 dns 分析. 就是免去 hostname 的查找, 没错的话, 在检测一整个 network 的时候, -n 会非常耗时.
-PN 是免去 ping scan, 普通的 nmap scan 是 ping 了对方后在进行检测. 可是有些电脑是已过滤 ping packet了的,所以当 nmap ping 不到的时候会跳过, 就这样逃过了一个电脑.
--script smb-check-vulns 是使用 smb-check-vulns.nse script. 就如之前介绍的, 这个方法是检测 windows 某些致命漏洞.
unsafe=1 是 smb-check-vulns 的仔细检测. unsafe 会彻底的扫描和尝试攻击对方. 更详细资料

最后的 172.16.2.0/24 就是我宿舍的 subnet.

来看看几个分析结果:
Windows + 139 & 445 service UP.
Nmap scan report for 172.16.2.66

Host is up (0.048s latency).

PORT    STATE SERVICE
139/tcp open  netbios-ssn

445/tcp open  microsoft-ds
MAC Address: 00:1F:3C:DB:F1:1F (Intel Corporate)
Host script results:

| smb-check-vulns: 

|   Conficker: Likely CLEAN; access was denied.

| |  If you have a login, try using --script-args=smbuser=xxx,smbpass=yyy

| |  (replace xxx and yyy with your username and password). Also try

| |_ smbdomain=zzz if you know the domain. (Error NT_STATUS_ACCESS_DENIED)

|_  SMBv2 DoS (CVE-2009-3103): VULNERABLE

Windows + 139 & 445 service DOWN.

Nmap scan report for 172.16.2.145
Host is up (0.24s latency).
PORT    STATE    SERVICE

139/tcp filtered netbios-ssn

445/tcp filtered microsoft-ds

MAC Address: 00:12:F0:CD:62:DB (Intel Corporate)

unknown OS + 139 UP & 445 DOWN.

Nmap scan report for 172.16.2.159
Host is up (0.0041s latency).
PORT    STATE  SERVICE
139/tcp open   netbios-ssn
445/tcp closed microsoft-ds
MAC Address: 00:1A:6B:38:D4:DE (USI)
Host script results:
| smb-check-vulns: 
|   Conficker: UNKNOWN; not Windows, or Windows with disabled browser service (CLEAN); or Windows with crashed browser service (possibly INFECTED).
| |  If you know the remote system is Windows, try rebooting it and scanning
| |_ again. (Error NT_STATUS_OBJECT_NAME_NOT_FOUND)
|_  SMBv2 DoS (CVE-2009-3103): VULNERABLE




还有其他方法:
使用 Colasoft 的 Capsa Network Analyzer. 按我
使用 HoneyNet 来捕捉. 按我
使用 Nessus 或者 Ngrep. 按我

下一个我会尝试的最有可能是 Nessus 或者 Ngrep, 因为这两个是好用的工具, 随机随处随网随手可得!
然后测试了 Colasoft, 果然, 要给钱的东西果然不一样,很仔细的.....
最后是 HoneyNet, 之前又想要学,却没有时间与机会学......
据我所了解的是, HoneyNet 是最好的...