type
status
date
slug
summary
tags
category
icon
password
wireshark入门:
他这里顺序有点误,应该是 P1-P26,P32-P39,P27-P31
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff33bfa3e-e297-43fb-904f-59b7321bb16b%2FUntitled.png?table=block&id=43b60002-1c75-49a9-84db-fa1cd4cc7300&t=43b60002-1c75-49a9-84db-fa1cd4cc7300&width=1028&cache=v2)
Wireshark 入门
伯克利包过滤 - Wireshark包过滤
BPF(Berkeley Packet Filter) 采用与自然语言相近的语法,利用语法构造字符串确定保留具体符合规则的数据包而忽略其他数据包
最简单语法空白字符,任何数据包都符合空白字符规则
语法规则
- type表示对象 如 IP地址、子网或端口 -> host、net、port
- dir 表示数据包传输的方向 -> src、dst
- proto 表示与数据包匹配的协议类型 -> ether、ip、tcp、arp
演示实例
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F05d2ea0c-1893-42b2-9370-0f2265637633%2FUntitled.png?table=block&id=3b201897-e4f6-48e5-a101-4faf681bf9fd&t=3b201897-e4f6-48e5-a101-4faf681bf9fd&width=1838&cache=v2)
会发现直接在 Apply a display filter 里输入是无法过滤的,
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F8f588f6d-fa61-4af3-9591-f2d49f52c425%2FUntitled.png?table=block&id=4cab4609-ef34-4a90-9ea8-7ec355635e92&t=4cab4609-ef34-4a90-9ea8-7ec355635e92&width=2030&cache=v2)
新版的 wireshark 的 expression 功能在如下图所示这里
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fbade0c37-82ee-4a4d-aeac-5e5d9c9956cd%2FUntitled.png?table=block&id=377c7ba7-d077-4e14-9652-6ecf928615e0&t=377c7ba7-d077-4e14-9652-6ecf928615e0&width=1092&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fa7e07b27-519b-4eec-8261-72108237e9a1%2FUntitled.png?table=block&id=11a78e6b-191a-4de5-8b99-06bc420961ed&t=11a78e6b-191a-4de5-8b99-06bc420961ed&width=1364&cache=v2)
在 wireshark 里,不是直接使用 host 来表示主机名和对应的 ip 地址,而是使用
ip.addr = <ip>
来表示
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc2d0c6cd-9599-450f-bf90-faf9bccdf3f0%2FUntitled.png?table=block&id=f0948932-2c8f-4bfc-842e-28e285a4d159&t=f0948932-2c8f-4bfc-842e-28e285a4d159&width=2048&cache=v2)
其他也是类似,如
ip.src
和 ip.dst
在找服务这一块,服务都是以占用端口的形式展示的,因此可以通过这种形式来看怎么用,然后点OK即可。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fb7195dff-6ea0-4105-b994-5ad8dd9e0c07%2FUntitled.png?table=block&id=68676cd1-ed5e-439b-9c7c-09ad5b9136d7&t=68676cd1-ed5e-439b-9c7c-09ad5b9136d7&width=1382&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5ba2cbae-5f98-4d2c-ba0b-4c72095cdf01%2FUntitled.png?table=block&id=40fbd025-4072-414a-97ae-7458b1309763&t=40fbd025-4072-414a-97ae-7458b1309763&width=1858&cache=v2)
也可以使用 逻辑运算符实现筛选,如
tcp.port == 80 and ip.src == 192.168.123.37
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff6ad5757-fee6-4cfe-bd11-4cfe618567c2%2FUntitled.png?table=block&id=3df953bf-8a4d-4617-ba51-19fa6a3b1739&t=3df953bf-8a4d-4617-ba51-19fa6a3b1739&width=1776&cache=v2)
当然也有类似补全的操作
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F95c6b207-d0ca-420f-9bee-c3bbc5d89960%2FUntitled.png?table=block&id=b252fb38-2dbe-4c93-b742-0b7e8a4dc5a7&t=b252fb38-2dbe-4c93-b742-0b7e8a4dc5a7&width=644&cache=v2)
wireshark包过滤器分类 - 遵循伯克利语法规则
捕获过滤器 -> 在抓包之前进行设置,在抓取时,就不会抓取不符合文件的数据包
- 只捕获目标端口为80的TCP数据包 -> tcp dst port 80
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F80f4f6f3-6bc4-41c8-9d2d-c606a6dc23e1%2FUntitled.png?table=block&id=d3ec9419-c0a8-49c5-ac24-facd762c513b&t=d3ec9419-c0a8-49c5-ac24-facd762c513b&width=1854&cache=v2)
- 捕获目的主机IP地址为 192.168.123.37 的数据包 -> dst host 192.168.123.37
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F9c69c6a9-f2d9-411c-9108-4dc4e0c7ae75%2FUntitled.png?table=block&id=f43a6d0d-d494-4f28-a3e9-25707175e653&t=f43a6d0d-d494-4f28-a3e9-25707175e653&width=1940&cache=v2)
- host 不支持 cidr 域名 书写
筛选过滤器 (显示过滤器)-> 抓包之后进行应用的,即再次筛选
然后显示过滤器有两种创建方式
- 输入框创建
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fee9031dc-f32a-431c-973c-93c2a90b13bb%2FUntitled.png?table=block&id=af01ca15-2cd0-41ad-8043-72237f23b871&t=af01ca15-2cd0-41ad-8043-72237f23b871&width=1978&cache=v2)
当不知道如何创建就看下图这里
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4c3e6265-337e-483f-8b0b-e985ce0b0958%2FUntitled.png?table=block&id=c9c90b6d-7665-4249-99e6-1f3364214bb3&t=c9c90b6d-7665-4249-99e6-1f3364214bb3&width=1092&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F6c924904-fb8f-426e-847a-ad74f2c8d129%2FUntitled.png?table=block&id=ed3bce28-2ada-4947-a911-bcf0435aa144&t=ed3bce28-2ada-4947-a911-bcf0435aa144&width=1676&cache=v2)
- 数据包细节面板创建
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F7c356f4f-da20-4e2a-851e-52676defffc7%2FUntitled.png?table=block&id=b76bafa2-b7ca-474e-8e98-b9de51832fcf&t=b76bafa2-b7ca-474e-8e98-b9de51832fcf&width=1916&cache=v2)
... and Selected
表示 目前的过滤器 + and 进行连接
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F9e020609-0c4f-49a4-b7f8-152387807ec2%2FUntitled.png?table=block&id=1371f887-fb4a-47a8-8c1b-54799b3a3668&t=1371f887-fb4a-47a8-8c1b-54799b3a3668&width=1742&cache=v2)
一开始是只有
Selected
和 Not Selected
的- 表达式规则
- 主题 + 运算符 + 值
- 逻辑关系 与 或 非 -> and (&&) or (||) not (!)
Wireshark 捕获数据包文件保存
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fe514cb2a-21f3-4b63-8d98-c5ffe6d7510d%2FUntitled.png?table=block&id=8bad0221-3533-41de-b98e-e403557ead01&t=8bad0221-3533-41de-b98e-e403557ead01&width=1664&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F65d32fef-775f-44b2-85e5-f3dd61405deb%2FUntitled.png?table=block&id=b9d47d4e-b6f0-4410-92c0-115138503c01&t=b9d47d4e-b6f0-4410-92c0-115138503c01&width=1874&cache=v2)
杂项设置
wireshark 数据包颜色的意思
可以通过 视图 -> 着色规则进行查看
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F9a4d7467-adba-410a-a751-3ac4e25bd528%2FUntitled.png?table=block&id=5796d4c7-4670-488a-a907-97edef5309b0&t=5796d4c7-4670-488a-a907-97edef5309b0&width=411&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd8c7c78c-9913-4194-b68e-c5fa8d8dc738%2FUntitled.png?table=block&id=42da34f0-96be-4e71-8907-3ad8fa32bdc4&t=42da34f0-96be-4e71-8907-3ad8fa32bdc4&width=739&cache=v2)
wireshark 故障包过滤
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fb422c669-eff3-46e1-8a60-b34dd80f42da%2FUntitled.png?table=block&id=4270cf76-c627-4150-b751-3f2328fbce86&t=4270cf76-c627-4150-b751-3f2328fbce86&width=501&cache=v2)
有5个等级
- Error 严重错误,譬如:畸形数据包或识别出数据包协议头部的某些字段和预期值不符
- Warning 一般性问题(应用程序问题或通信问题),譬如:TCP zero window ,TCP window full ,TCP报文段失序,TCP报文段丢失
- Note 可能引发故障的异常现象(正常行为),譬如:TCP重传,重复确认,快速重传
- Chat 符合常规流量的特征,譬如:SYN,FIN,RST
- Comment
- OK
查看wireshark 内置文件路径
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fe0c7d07b-75e6-43a5-aa9b-10c2437561e4%2FUntitled.png?table=block&id=4969645d-d3d1-4b36-9136-e0b19273bc93&t=4969645d-d3d1-4b36-9136-e0b19273bc93&width=1816&cache=v2)
修改wireshark默认配置
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd801c8d8-05c2-48e8-9ce2-c049411704b2%2FUntitled.png?table=block&id=211d0c0e-ad50-44fd-ace2-7ad3a2f232a8&t=211d0c0e-ad50-44fd-ace2-7ad3a2f232a8&width=800&cache=v2)
Wireshark 网络分析
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F9b5faa6f-e158-4b9c-aba6-5ece58cea713%2FUntitled.png?table=block&id=54ff165d-b040-4390-9246-df8b76b0ef9f&t=54ff165d-b040-4390-9246-df8b76b0ef9f&width=2710&cache=v2)
# Wireshark 部署方式
远程数据包捕获
方式1:
开启远程桌面,rdp服务,在系统中安装wireshark进行抓包分析
缺点: 在于远程登录过程中,都会产生无关与目的远程连接数据流量
方式2: wireshark 远程抓包
windows
服务端: winpcap -> rpcapd
客户端: wireshark
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F2f42ffd4-3500-4a73-955c-c882a31a0fcb%2FUntitled.png?table=block&id=57034031-0199-4513-a190-72a6e84fa604&t=57034031-0199-4513-a190-72a6e84fa604&width=2206&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0abb1822-294c-4022-8857-9b1b618d90d1%2FUntitled.png?table=block&id=d711f399-6c88-448f-96bc-0d0ce1d56b47&t=d711f399-6c88-448f-96bc-0d0ce1d56b47&width=1902&cache=v2)
linux
macos
注意 macos 版本没有直接抓取数据包的功能,可参考
https://distanceblog.github.io/2020/06/05/wireshark%E8%BF%9C%E7%A8%8B%E6%8A%93%E5%8C%85/
本地数据包捕获
wireshark 不能抓取本地环回网卡数据包
不过可以使用 RawCap
https://www.netresec.com/?page=RawCap
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F04ae34b0-68ca-49a3-94b1-462a1ba6717f%2FUntitled.png?table=block&id=aaa362f7-e654-464c-ab49-d744fcd15a31&t=aaa362f7-e654-464c-ab49-d744fcd15a31&width=906&cache=v2)
然后浏览器访问 localhost
不过可以通过访问本机 ip 代替 localhost 间接捉取数据包(狗头
虚拟机数据包捕获
选择对应网卡即可。。。
比如在 kali 上运行
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fced77db7-994c-472d-a3d2-082eb3fd127d%2FUntitled.png?table=block&id=2dd234a0-cadd-4abd-9ed9-c56e90673344&t=2dd234a0-cadd-4abd-9ed9-c56e90673344&width=1702&cache=v2)
哈哈哈哈,原来arp广播还真就这么直白,,Who has ....? Tell ...(netdiscover 还真直白
ARP欺骗捕获数据包
攻击原则
- 任何主机均能发送伪造包给局域网中的另一主机;
- 任一主机相信它们接受到的所有包;
- 当一个新的响应包到达时,它甚至在没有请求包被发送的情况下覆盖掉旧的记录。
实践
kali 一般要先安装
kali 上运行
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1fceaee2-6779-4911-b875-804a0fa6fa58%2FUntitled.png?table=block&id=9eda8e95-d663-45fe-9214-3a4c437951aa&t=9eda8e95-d663-45fe-9214-3a4c437951aa&width=1468&cache=v2)
然后此时在
192.168.123.37
这台机器上wireshark 选择网卡 eth0,因为是欺骗这一张网卡,wireshark 筛选过滤器填入 icmp
查看![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F8f88b820-5354-4283-b725-b8704679677e%2FUntitled.png?table=block&id=ac127c76-357e-47b3-b9b3-dc46eb5283f7&t=ac127c76-357e-47b3-b9b3-dc46eb5283f7&width=1916&cache=v2)
会发现 192.168.123.1 的 mac 地址是 kali的。。。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5149b6aa-a09c-4227-9b34-4d88a388b68f%2FUntitled.png?table=block&id=e9cbb24b-cbb0-4de6-8500-0a60a6be1be9&t=e9cbb24b-cbb0-4de6-8500-0a60a6be1be9&width=1414&cache=v2)
所以在
192.168.123.37
上是上不了网的,除非kali上开启了数据包转发,当 ip_forward
为 0 时,欺骗的目标
上不了网,当该值为 1
时,会把192.168.123.37
发送的数据包做转发给网关,就可以正常上网,但是192.168.123.37
的数据包都会经过 kali。![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F837a6785-f764-42c2-b7f9-a846070e631a%2FUntitled.png?table=block&id=a2290c7b-b830-43c3-8c9a-707eac622f2d&t=a2290c7b-b830-43c3-8c9a-707eac622f2d&width=848&cache=v2)
Wireshark 网络安全
链路层安全
针对于交换机的安全问题
MAC对称欺骗 —— macchange
擦除只是暂时的,不是覆盖原来的mac地址,机器重启后就会恢复。
通过MAC地址欺骗达到隐藏真实主机的目的
设置前需要关闭网卡
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F143642fd-9e3b-4f58-8a5e-76a071d90f60%2FUntitled.png?table=block&id=0a372ffa-601f-4be7-aeb5-fa996a67da39&t=0a372ffa-601f-4be7-aeb5-fa996a67da39&width=1154&cache=v2)
随机化设置
MAC地址泛洪分析 —— 溢出交换机CAM表
交换机之所以可以交换数据,是因为交换机在内存中维护着一张CAM表,即 端口 <-> MAC地址
当表被添满时,其他主机就无法在对应的端口正常交互数据
wireshark 抓包分析
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F979f15cf-5e0c-4609-8ebe-e4a8e6aeac67%2FUntitled.png?table=block&id=bba2e058-ad2a-4c76-8b55-6ea9ae2b6def&t=bba2e058-ad2a-4c76-8b55-6ea9ae2b6def&width=738&cache=v2)
因为实际中,主要数据包类型是 tcp 或 udp
下面只有 ip 数据包,因此很可能有问题(当然有问题,哈哈
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F76bb6ac0-909a-493a-b51c-3da90069e0b7%2FUntitled.png?table=block&id=ac2d54a0-3483-4f7b-b91b-4699461d9e02&t=ac2d54a0-3483-4f7b-b91b-4699461d9e02&width=1520&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F59d0766f-ec5c-43ee-ae3f-aeb05508257e%2FUntitled.png?table=block&id=c8a2beb9-ba29-4428-8101-f7eb6ce9d001&t=c8a2beb9-ba29-4428-8101-f7eb6ce9d001&width=802&cache=v2)
很多无关的 ip 以及 mac地址,数据包很小
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fbe5d443a-bdb6-445d-8de4-9dfd3ff6b03b%2FUntitled.png?table=block&id=3b81005d-0375-41ad-890e-c14edb9f8d13&t=3b81005d-0375-41ad-890e-c14edb9f8d13&width=1890&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4be07721-0dcd-4776-9907-30dd264fda90%2FUntitled.png?table=block&id=539be028-4861-4b6d-a6e1-d0fc28d7e39c&t=539be028-4861-4b6d-a6e1-d0fc28d7e39c&width=1870&cache=v2)
查找源头端口
交换机
找到对应的端口
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F25b6df26-b6f8-42fa-80d9-fe5da565aa0f%2FUntitled.png?table=block&id=af96c4dc-3670-4204-9eeb-33b0913cd33e&t=af96c4dc-3670-4204-9eeb-33b0913cd33e&width=1508&cache=v2)
防御策略
限制交换机端口 MAC 地址数量,比如这个端口只能有3或5个,那他就只能添加3或5跳记录到CAM表,那么就无法溢出啦。
STP操纵
生成树协议按照树的结构构造网络拓扑,避免形成回路。STP协议中的各交换机通过交换BPDU报文信息传播生成树信息,如果伪造BPDU报文,控制交换机的端口转发状态,从而动态改变网络拓扑,劫持网络流量到本地。
广播风暴
ARP DHCP 通过在局域网中广播,占用网络资源,网络性能下降 -> 网络速度变慢
产生原因
- 网络短路引发广播风暴 -> 8根连接 两两连接 -> 互联网上网线导致网络性能下降
- 网络中存在环路引发广播风暴
- 网卡损坏引发广播风暴
- 蠕虫病毒引发广播风暴
网络层安全
中间人安全测试 - 欺骗
ARP协议
- 局域网内用来寻找主机发送数据包的协议,通过它可以找到指定 IP 地址对应的 MAC地址
- 每台终端设备都具有ARP缓存表
arp -a
查看缓存表arp -d
删除缓存表- 表的填充,寻找 IP 地址对应MAC地址,如果没有则广播此时设置的目标MAC地址为 (00:00:00:00:00:00) 是否具有IP地址对应的MAC地址,找到填充。
ARP协议分析介绍
显示过滤器
- arp
- 请求数据包
- arp.opcode == 0x0001
- 响应数据包
- arp.opcode == 0x0002
- 查看源 MAC 地址
- arp.src.hw_mac == 00:00:00:00:00:00
- arp.src.hw_mac == 00:00:00:00:00:00 && arp.opcode == 0x0002
专家系统分析
网关地址与局域网中的计算机具有一致的MAC地址
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fe3363f5a-75f5-4312-b37b-7bd1dab15a1a%2FUntitled.png?table=block&id=8a00e76e-965b-430f-a70e-d54da5afaef9&t=8a00e76e-965b-430f-a70e-d54da5afaef9&width=1358&cache=v2)
出现大量ARP数据包的原因
- ARP主机扫描
- ARP病毒进行通信
- ARP欺骗 中间人安全测试
防御ARP欺骗措施
- 静态绑定ARP表
- arp -s 网关的IP地址 网关的MAC地址
- 不适合大型网络使用
- 需要管理员权限
- win
netsh i i show in
-> 查看网卡编号 - win
netsh -c "i i" add neighbors <网卡编号> <网关IP地址> <网关MAC地址>
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fde007077-ea99-4574-b9bf-476f09953893%2FUntitled.png?table=block&id=449be9e5-4393-47a2-82a0-7bb8a7a8a951&t=449be9e5-4393-47a2-82a0-7bb8a7a8a951&width=1516&cache=v2)
- 交换机也有端口安全配置,固定MAC和IP使用端口
- 不适合大型网络使用
- 交换机 DHCP-Snooping
- 交换机监听DHCP数据,提取IP和MAC建立DHCP Snooping的绑定表
- 划分VLAN
- 每一个VLAN就是一个广播域 -> 限制网络范围
泪滴安全测试
原理介绍
- 针对于IP协议的安全测试,主要是伪造IP地址和发送畸形数据包
- 向目标发送畸形数据包,使得IP数据包碎片在重组的过程中有重合的部分(偏移位置不够),从而导致目标系统无法进行重组,进一步导致系统奔溃而停止服务。
根据数据包表示 Identification 来确实是否属于同一分组
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F17389048-1636-4bce-b6bc-8335ea376de5%2FUntitled.png?table=block&id=65ebcc9c-ea38-4866-981d-313fa5df20e0&t=65ebcc9c-ea38-4866-981d-313fa5df20e0&width=1780&cache=v2)
分析 第8和第9个数据包
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5e10c6d3-b560-44d0-9c9d-952e84b6d0de%2FUntitled.png?table=block&id=e4e68efc-9672-46b8-a2e5-64bf94445939&t=e4e68efc-9672-46b8-a2e5-64bf94445939&width=2088&cache=v2)
偏移量仅为 24,远不够36。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F943b56af-b2d1-4bda-9275-de72f4fcba08%2FUntitled.png?table=block&id=fd010c0e-fc07-4fad-a4f2-22def3b51290&t=fd010c0e-fc07-4fad-a4f2-22def3b51290&width=2128&cache=v2)
因此无法重组
不过对现在的计算机来说,泪滴测试不会对计算机造成很大的影响,所以基本不关心泪滴安全测试了。不够泪滴测试和ARP泛洪结合,还是能对计算机造成很大的困扰。
传输层安全
传输层主要针对TCP和UDP协议,因此拒绝服务DOS(Denial of Service)也主要是基于这两个协议
TCP SYN 泛洪
TCP连接介绍
- 客户端发送SYN到服务器
- 服务器响应 SYN+ACK 到客户机
- 客户机发送ACK到服务器
使用 wireshark 分析 TCP 三次握手数据包
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc49a6411-ad22-4646-9872-648bb3ab6d05%2FUntitled.png?table=block&id=266429cb-f645-4c91-9090-54baf85d9add&t=266429cb-f645-4c91-9090-54baf85d9add&width=2562&cache=v2)
TCP SYN flooding 安全测试
原理
- 客户端发送syn服务端返回syn+ack,如果客户端不再发送ack,那么服务端将等待超时,重新发送syn+ack。如果是大量的等待,就可能导致服务器奔溃。
案例演示
- q: 安静模式
- n: 数字化输出,象征性输出主机地址
- -rand-source: 随机源IP
- S: 发送SYN数据包
- p: 指向端口
- -flood: 使用泛洪
为了便于分析。打开 Statistics -> Flow Graph
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F7511d517-831f-478e-bc05-e5e39f548a60%2FUntitled.png?table=block&id=f42dede3-0f2c-419a-9bb6-65c5366382f3&t=f42dede3-0f2c-419a-9bb6-65c5366382f3&width=976&cache=v2)
先选择流类型为TCP
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5d3cd2df-9fcb-43f7-9baf-4e4a78bcdb73%2FUntitled.png?table=block&id=3a676ac1-ae25-4d4e-8cf1-16f68b2a7ef2&t=3a676ac1-ae25-4d4e-8cf1-16f68b2a7ef2&width=1806&cache=v2)
发现客户端发送syn服务端返回syn+ack,但客户端不再发送ack,导致资源消耗。
TCP SYN flooding安全防御
- 丢弃第一个SYN数据包 -> 用户体验差
- 反向探测 -> 向源地址方向发送探测包,确定源地址合法性
- 代理模式 -> 防火墙代理 -> 即先与防火墙建立tcp连接
UDP 泛洪
非连接状态的协议,简洁协议,控制选项少,不可靠,传输速率高,适合大文件传输
UDP协议关键点
- 源端口
- 目的端口
- UDP报文长度
- 检验码
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fe47f05ca-97ea-4083-8ffd-a5a45ff73ae6%2FUntitled.png?table=block&id=1c8d8315-f69c-48ff-995b-c6667195f9ba&t=1c8d8315-f69c-48ff-995b-c6667195f9ba&width=1632&cache=v2)
UDP flooding 安全测试
原理: 测试人员向目标发送大量巨大的UDP数据包,就会使网络资源被耗尽
- a: 伪造的 ip -s: 53端口
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F771ecee5-da8e-43c2-b6ca-34f16e9f640c%2FUntitled.png?table=block&id=a3c75d9b-e1e5-4ddd-8d44-9352e0a4c1d8&t=a3c75d9b-e1e5-4ddd-8d44-9352e0a4c1d8&width=1852&cache=v2)
UDP flooding 安全防御
防火墙
- 限流: 将链路中的UDP报文控制在合理的范围,当超过指定值,则丢弃UDP报文
- 指纹学习: 先学习,在匹配
网络取证简析
wireshark 恢复传输文件
无论使用何种应用层协议,对于传输层来说都是TCP或UDP协议,来恢复一下wireshark官网提供的文件
https://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=view&target=http_with_jpegs.cap.gzhttp_with_jpegs.cap.gz
首先在显示过滤器中筛选具有jpeg内容的数据包:
http contains "jpeg"
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F992557e7-4012-45a9-80e5-a764ec3b70c9%2FUntitled.png?table=block&id=fc0fe654-f961-4d9c-8765-6f746dd70c2d&t=fc0fe654-f961-4d9c-8765-6f746dd70c2d&width=2212&cache=v2)
选第一个,追踪tcp流
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0db6f26c-d6d9-49a7-be4c-2fc380266b5f%2FUntitled.png?table=block&id=e6d2f633-7691-4b95-a23d-0f04aa824a12&t=e6d2f633-7691-4b95-a23d-0f04aa824a12&width=1936&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5c62ecf5-a4c3-4237-949d-daba4d6d1228%2FUntitled.png?table=block&id=db7260b2-b8ff-4ffd-9e6f-2587b1b36727&t=db7260b2-b8ff-4ffd-9e6f-2587b1b36727&width=1540&cache=v2)
最后点一下 Save as... 保存为 xxx.bin 就好,然后用16进制编辑器打开,JPEG的文件开始字节为
FF D8
,文件结束字节为 FF D9
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd7f3fcb2-b47e-4e7a-93e3-684ad8a104e5%2FUntitled.png?table=block&id=fcfc1c1a-39b0-44f5-954b-6b58f9ac8b95&t=fcfc1c1a-39b0-44f5-954b-6b58f9ac8b95&width=1540&cache=v2)
然后把其余没用的都删除掉,这里因为结束符号就是最后了,因此把上图
FF D8
之前的都删除掉就好了。![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ffeb0e05f-9000-4f78-bfc8-ecb652c62d33%2FUntitled.png?table=block&id=1860bbc2-7e4c-4b91-9e62-e50c8de36a76&t=1860bbc2-7e4c-4b91-9e62-e50c8de36a76&width=1584&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd209b5be-ec70-420d-b714-61af347ee41d%2FUntitled.png?table=block&id=1654edac-8117-4899-8cdd-4a3447471b92&t=1654edac-8117-4899-8cdd-4a3447471b92&width=1444&cache=v2)
成功恢复。
取证实践案例
https://forensicscontest.com/2009/09/25/puzzle-1-anns-bad-aim
好像没了。。。然后在Github找了个: https://github.com/aarud/Pcaps/blob/master/evidence01.pcap
1.寻找Ann的通信好友名称
根据题目名称提示 aim 通信,wireshark 自带 aim 解密
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fbdbd511a-feb1-414d-ba84-9eda39bfc5e0%2FUntitled.png?table=block&id=8fd3f5dc-9709-49f4-9053-1048d3299cca&t=8fd3f5dc-9709-49f4-9053-1048d3299cca&width=1042&cache=v2)
这三项依次改为
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F959e421f-83c2-46b6-944b-a2692ff1a448%2FUntitled.png?table=block&id=cc4a7503-a530-4ee5-b132-090de915e8a2&t=cc4a7503-a530-4ee5-b132-090de915e8a2&width=942&cache=v2)
然后查看数据包,发现通信好友名称是 Sec558user1
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F792dc237-2538-43f5-812f-452652ebaa5e%2FUntitled.png?table=block&id=c81de4b3-a950-4c13-82ab-9d87b1c7f0b5&t=c81de4b3-a950-4c13-82ab-9d87b1c7f0b5&width=1680&cache=v2)
2. 通信过程中的第一条信息内容是什么
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F98acf601-c9e0-445e-b2b3-93b63e31911b%2FUntitled.png?table=block&id=9007dbfc-462e-484e-8a47-86d4265439d4&t=9007dbfc-462e-484e-8a47-86d4265439d4&width=2166&cache=v2)
3. Ann 通信过程中传输的文件名字
显示过滤器输入
data
,然后追踪tcp流
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff1528eab-57e6-4303-b673-4a9d800beee2%2FUntitled.png?table=block&id=85ae768f-1920-48a5-8a92-b2350e2f2eb0&t=85ae768f-1920-48a5-8a92-b2350e2f2eb0&width=2226&cache=v2)
文件名字
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F061536cc-d9a9-4ea8-93ae-b8cce0a5774f%2FUntitled.png?table=block&id=7bbc66f0-ea4c-48fc-8d11-0c228a69ea6f&t=7bbc66f0-ea4c-48fc-8d11-0c228a69ea6f&width=1502&cache=v2)
4. 还原Ann发送文件并得出文件幻数(magic number)
文件幻数介绍: https://baike.baidu.com/item/magic%20number
说直白点就是以 zip 之父的首字母PK来命名,对应的16进制是
50 4B 03 04
50(P)4B(K)03(文本结束)04(传输结束),组合起来就是压缩包的标识开头。
那为啥word文档的文件开头是这个,把word文档后缀改为.zip
试试,这是微软2006年公布的OOXML规范。显示过滤器输入
data
,然后追踪tcp流![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1887badf-4096-44c8-ada0-dfe50f290fb9%2FUntitled.png?table=block&id=3150ea6b-aac8-45f7-9fb7-c600940f7dc6&t=3150ea6b-aac8-45f7-9fb7-c600940f7dc6&width=1540&cache=v2)
另存为,
xxx.bin
,用16进制编辑器打开xxx.bin
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc0e12e68-f885-4481-b6e2-fa5723c2f96d%2FUntitled.png?table=block&id=92390b7c-e0fd-47f0-a124-62991f42fb89&t=92390b7c-e0fd-47f0-a124-62991f42fb89&width=1104&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5a5fa44c-8750-4910-9b04-b59906b350c1%2FUntitled.png?table=block&id=08e0734f-57c5-4c01-85bd-9b61c7b9ef44&t=08e0734f-57c5-4c01-85bd-9b61c7b9ef44&width=1418&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F8da9ea23-b8bd-4ef3-8b54-62e86a7fd7ff%2FUntitled.png?table=block&id=752c188e-184f-4f3e-989b-232b2d6a8b5e&t=752c188e-184f-4f3e-989b-232b2d6a8b5e&width=2500&cache=v2)
5. 查看文件md5值
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F522786b6-d3d3-45bc-82ee-3f603436674e%2FUntitled.png?table=block&id=025c0dea-006f-4e6c-979f-ca64910b9ccd&t=025c0dea-006f-4e6c-979f-ca64910b9ccd&width=762&cache=v2)
应用层网络安全
暴力破解分析
分析使用 medusa 破解 ssh 登录
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ffa035b10-4307-426a-9548-1ce9a8a92767%2FUntitled.png?table=block&id=ea012f45-8f7d-43ba-8dd7-2c94140b66c9&t=ea012f45-8f7d-43ba-8dd7-2c94140b66c9&width=1784&cache=v2)
后门分析
某些软件具有其他的目的 -> 设置隐藏后门
这里针对vsftpd 2.3.4 后门
帐号密码不要紧,有
:)
笑脸就行,因此这个后门也被称为笑脸后门,2333![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1618fbd3-7452-4b38-927d-a3b845591c61%2FUntitled.png?table=block&id=5b568066-37d0-4ea5-9964-3799c96d0c04&t=5b568066-37d0-4ea5-9964-3799c96d0c04&width=1916&cache=v2)