網絡掃描:遠程登錄服務
遠程登錄服務可以將用戶計算機與遠程主機連接起來,在遠程計算機上運行程序,將相應的屏幕顯示傳送到本地主機,并將本地的輸入發送給遠程計算機。最常見的遠程登錄服務有RDP、SSH和VNC等。本文介紹對遠程登錄服務實施掃描的方法。
1. RDP服務
RDP(Remote Desktop Protocol,遠程桌面協議)是一個多通道的協議,可以讓用戶連上提供微軟終端機服務的計算機。RDP服務是基于TCP協議工作的,其工作在TCP協議的3389端口。我們可以借助Nmap的rdp-enum-encryption腳本來實施掃描。rdp-enum-encryption腳本用來判斷RDP服務支持的安全級別和加密級別。語法格式如下:
nmap -p 3389 --script=rdp-enum-encryption
掃描目標主機上的RDP服務。執行命令如下:
root@daxueba:~# nmap -p 3389 --script rdp-enum-encryption 118.25.151.112
Starting Nmap 7.70 ( https://nmap.org ) at 2021-081-16 15:52 CST
Nmap scan report for 118.25.151.112
Host is up (0.040s latency).
PORT STATE SERVICE
3389/tcp open ms-wbt-server
| rdp-enum-encryption:
| Security layer #安全級別
| CredSSP: SUCCESS
| Native RDP: SUCCESS
| SSL: SUCCESS
| RDP Encryption level: Unknown #RDP加密級別
|_ 128-bit RC4: SUCCESS
Nmap done: 1 IP address (1 host up) scanned in 2.08 seconds
從輸出的信息中可以看到,目標主機開放了RDP服務,并且顯示出了支持的安全級別和加密級別信息。
2. SSH服務
SSH(Secure Shell)由IETF的網絡小組(Network Working Group)所制定。SSH是建立在應用層基礎上的安全協議,是基于TCP協議工作的,其工作在TCP的22號端口。我們可以借助Nmap的腳本來實施掃描。
(1)使用ssh2-enum-algos腳本
ssh2-enum-algos腳本用來獲取SSH服務支持的加密算法。語法格式如下:
nmap --script=ssh2-enum-algos < target >
使用ssh2-enum-algos腳本掃描SSH服務。執行命令如下:
root@daxueba:~# nmap -p 22 --script ssh2-enum-algos 192.168.1.6
Starting Nmap 7.70 ( https://nmap.org ) at 2021-08-16 15:55 CST
Nmap scan report for 192.168.1.6 (192.168.1.6)
Host is up (0.00028s latency).
PORT STATE SERVICE
22/tcp open ssh
| ssh2-enum-algos:
| kex_algorithms: (4)
| diffie-hellman-group-exchange-sha256
| diffie-hellman-group-exchange-sha1
| diffie-hellman-group14-sha1
| diffie-hellman-group1-sha1
| server_host_key_algorithms: (2)
| ssh-rsa
| ssh-dss
| encryption_algorithms: (13)
| aes128-cbc
| 3des-cbc
| blowfish-cbc
| cast128-cbc
| arcfour128
| arcfour256
| arcfour
| aes192-cbc
| aes256-cbc
| rijndael-cbc@lysator.liu.se
| aes128-ctr
| aes192-ctr
| aes256-ctr
| mac_algorithms: (7)
| hmac-md5
| hmac-sha1
| umac-64@openssh.com
| hmac-ripemd160
| hmac-ripemd160@openssh.com
| hmac-sha1-96
| hmac-md5-96
| compression_algorithms: (2)
| none
|_ zlib@openssh.com
MAC Address: 00:0C:29:3E:84:91 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 0.42 seconds
從以上輸出信息中可以看到目標主機上支持的所有加密算法。
(2)使用sshv1腳本
sshv1腳本用來檢測SSH服務是否支持SSH協議版本1(SSHv1)。語法格式如下:
nmap --script=sshv1 -p 22
使用sshv1腳本實施掃描。執行命令如下:
root@daxueba:~# nmap --script=sshv1 -p 22 144.202.128.3
Starting Nmap 7.70 ( https://nmap.org ) at 2021-08-16 17:06 CST
Nmap scan report for console.transsys.com (144.202.128.3)
Host is up (0.32s latency).
PORT STATE SERVICE
22/tcp open ssh
|_sshv1: Server supports SSHv1
Nmap done: 1 IP address (1 host up) scanned in 2.73 seconds
從輸出信息中可以看到,目標服務器支持SSHv1版本。
3. VMware服務
VMware用來對外提供虛擬化服務。該服務是基于TCP協議工作的,其工作在TCP的443端口。我們可以使用Nmap的vmware-version腳本對VMware服務實施掃描,vmware-version腳本用來獲取VMware服務的版本信息。語法格式如下:
nmap --script=vmware-version -p 443 [host]
使用vmware-version腳本掃描VMware服務。執行命令如下:
root@daxueba:~# nmap --script=vmware-version -p 443 134.119.193.210
Starting Nmap 7.70 ( https://nmap.org ) at 2021-08-16 16:45 CST
Nmap scan report for 134.119.193.210
Host is up (0.20s latency).
PORT STATE SERVICE
443/tcp open https
| vmware-version:
| Server version: VMware ESXi 6.5.0 #服務版本
| Build: 4887370 #內置編號
| Locale version: INTL 000 #本地版本
| OS type: vmnix-x86 #操作系統類型
|_ Product Line ID: embeddedEsx #產品行ID
Service Info: CPE: cpe:/o:vmware:ESXi:6.5.0
Nmap done: 1 IP address (1 host up) scanned in 2.31 seconds
從輸出信息中可以看到,目標主機中開放了VMware服務,并且獲取到了該服務對應的信息。
4. VNC服務
VNC服務是基于TCP協議工作的,其工作在TCP的5900端口。我們可以借助Nmap的vnc-info和vnc-title腳本實施VNC服務掃描。下面介紹實施VNC服務掃描的方法。
vnc-info腳本用來獲取VNC服務的協議版本及支持的安全類型。語法格式如下:
nmap -p 5900 --script=vnc-info
使用vnc-info腳本獲取VNC服務的版本及支持的安全類型。執行命令如下:
root@daxueba:~# nmap -p 5900 --script=vnc-info 192.168.1.6
Starting Nmap 7.70 ( https://nmap.org ) at 2021-08-16 16:33 CST
Nmap scan report for 192.168.1.6 (192.168.1.6)
Host is up (0.00036s latency).
PORT STATE SERVICE
5900/tcp open vnc
| vnc-info:
| Protocol version: 3.3 #協議版本
| Security types: #安全類型
|_ VNC Authentication (2)
MAC Address: 00:0C:29:3E:84:91 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 0.36 seconds
從輸出信息中可以看到,目標主機開啟了VNC服務,并且獲取到了VNC服務的基本信息。例如,該服務的協議版本為3.3,安全類型為VNC Authentication。