某塔的線上比賽平臺,最後一道一堆蜜罐,聽說沒flag,反正沒找到。然後看一下其中一道ICMP隧道的題目。
數據包如圖:
當時的考量:
響應包有的,請求包也有,並且都一樣,所以請求包的數據是最全的,可以不看響應包。
考慮到填充不符合正常的ICMP請求應答的填充方式,也嘗試了對數據進行解密,但都無果。
兩個通信IP沒有什麼有用信息。
考慮過包長度轉ASCII字符的這個問題,但是看到整個包的長度超過了127,覺得不太可能就放棄了。後來實在找不出來,看了下ICMP包頭長度,然後明白了可能只是數據長度。
以下是解題腳本:
#!/usr/bin/python
# coding=utf8
# @Author:B1u3Buf4
import pyshark
import base64
L_flag= []
packets = pyshark.FileCapture('xxx.pcap')
for packet in packets:
for pkt in packet:
if pkt.layer_name == "icmp":
if int(pkt.type) != 0:
L_flag.append(int(pkt.data_len))
print(base64.b64decode(''.join([chr(c) for c in L_flag])))
有老哥吐槽說這題太腦洞了,誰能構造這樣的流量也是夠煞費苦心了。沒有直接的文本特徵,識別起來比較麻煩的,確實有一定的隱蔽性,但是作隧道可能通信效率太低了。然後無聊就寫了一個構造這樣發包的。
#!/usr/bin/python
# coding=utf8
# @Author:B1u3Buf4
import string
import time
import random
from scapy.all import *
def ICMP_tunnel_sender(dip, words):
i = 0
dic = string.ascii_lowercase
for char in words:
length = ord(char)
data = ''.join([dic[i % 26] for i in range(length)])
p = IP(dst=dip)/ICMP(type=8, code=0, id=1, seq=i)/data
send(p)
i += 1
time.sleep(random.randint(1, 10)/10)