TCP劫持攻击
攻击思路
1、hacker获取client与server的tcp会话包(通过arp毒化,mac泛洪攻击等);
2、观察server给client主机发送的tcp报文,以获取client将要给server发送的下一个报文信息;
3、hacker通过工具伪造一个tcp报文,发送给server,其内容信息通过步骤2中获取的报文来确定。
需要的大致报文信息:
(1)二层的source-mac是hacker机
(2)三层的源IP是client的ip,目标IP是server的ip
(3)四层的参数则是需要通过步骤2获取
注意:server判断会话只能通过三层与四层的信息
接下来我们搭建一个实验来实现TCP劫持攻击操作:
实验拓扑
设备说明
这里的A、B我们使用红帽linux来模拟,C则用kali虚拟机来模拟。
攻击步骤
一、被攻击者A telnet 服务器B
首先被攻击者A先去telnet服务端B,成功后,再输入“ls”的命令,查看B当前路径下的文件
二、抓取telnet流量
之后再在攻击者C使Wireshark抓取Telnet流量。
首先看到最下面的一个数据包,这个是服务器B给被攻击主机A发的最后一个数据包:
从这个数据包中我们可以看到一些信息:源目IP地址、源目端口号、下一个想要的序列号27303572431、ack确认号733859712、Flags标记(PSH、ACK)。
这里需要注意一点:
如果看到序列号和ACK确认号是一个很小的值,则需要进行如下操作:
将图中②的√去掉
三、然后进入kali虚拟机开始伪造TCP报文
输入netwox,使用netwox工具伪造报文:
以下为netwox工具中TCP的欺骗包的路径,序号为40:
kali@kali:~/Desktop$ netwox
Netwox toolbox version 5.39.0. Netwib library version 5.39.0.
######################## MAIN MENU #########################
0 - leave netwox
3 - search tools
4 - display help of one tool
5 - run a tool selecting parameters on command line
6 - run a tool selecting parameters from keyboard
a + information
b + network protocol
c + application protocol
d + sniff (capture network packets)
e + spoof (create and send packets)
f + record (file containing captured packets)
g + client
h + server
i + ping (check if a computer if reachable)
j + traceroute (obtain list of gateways)
k + scan (computer and port discovery)
l + network audit
m + brute force (check if passwords are weak)
n + remote administration
o + tools not related to network
Select a node (key in 03456abcdefghijklmno): b
##################### network protocol #####################
0 - leave netwox
1 - go to main menu
2 - go to previous menu
3 - search tools
4 - display help of one tool
5 - run a tool selecting parameters on command line
6 - run a tool selecting parameters from keyboard
a + Ethernet
b + IP
c + UDP
d + TCP
e + ICMP
f + ARP
Select a node (key in 0123456abcdef): d
########################### TCP ############################
0 - leave netwox
1 - go to main menu
2 - go to previous menu
3 - search tools
4 - display help of one tool
5 - run a tool selecting parameters on command line
6 - run a tool selecting parameters from keyboard
a + TCP spoof
b + TCP client
c + TCP server
d + network audit using TCP
e + dns
f + ftp
g + http
h + ident
i + irc
j + nntp
k + smb
l + smtp
m + telnet
n + whois
Select a node (key in 0123456abcdefghijklmn): a
######################## TCP spoof #########################
0 - leave netwox
1 - go to main menu
2 - go to previous menu
3 - search tools
4 - display help of one tool
5 - run a tool selecting parameters on command line
6 - run a tool selecting parameters from keyboard
a - 36:Spoof EthernetIp4Tcp packet
b - 40:Spoof Ip4Tcp packet
c - 42:Spoof of packet samples : fragment
d - 43:Spoof of packet samples : fragment, ip4opt:noop
e - 44<