5G协议漏洞挖掘工具:5greplay --一款5G网络流量fuzz工具 使用教程

介绍

5Greplay 是一款 5G 网络流量模糊器,可通过重放和修改 5G 网络流量来评估 5G 组件,方法是创建网络场景并将其注入目标,目标可以是 5G 核心服务(如 AMF、SMF)或 RAN 网络(如 gNodeB)。该工具能够以非常灵活的方式在线或离线更改控制平面和数据平面中的网络数据包。
github地址:https://github.com/Montimage/5Greplay
官方使用文档:https://5greplay.org/docs.html
截止到2023年7月,已更新到0.0.7版本
本文运行环境:Ubuntu22.04

安装

1.直接下载安装

#Install wget to be able to download 5Greplay
sudo apt update && sudo apt install -y wget
# Download 5Greplay
wget https://github.com/Montimage/5Greplay/releases/download/v0.0.7/5greplay-0.0.7_Linux_x86_64.tar.gz
tar -xzf 5greplay-0.0.7_Linux_x86_64.tar.gz
cd 5greplay-0.0.7 
./5greplay -h

0.0.1版本正常运行,
目前发现0.0.7版本运行会出现问题,
./5greplay: error while loading shared libraries: libmmt_tcpip.so: cannot open shared object file: No such file or directory
可能作者在编译链接程序时没有将./plugins路径携带引入
在这里插入图片描述

导致找不到libmmt_tcpip.so
在这里插入图片描述

可以执行以下命令来解决

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./plugins
#我的路径为/home/ubuntu22/5greplay-0.0.7/plugins

但是每次执行shell时都要输一遍命令来修改环境变量$LD_LIBRARY_PATH的值,如果要持久化生效,可以在/etc/profile或~/.bashrc等shell初始化文件中做永久性设置。
也可以通过编译链接程序时,将rpath携带引入,进行硬编码设置。
采用编译安装和docker安装方法可以参考官方文档

2.编译源代码安装

https://5greplay.org/docs/guide/building-from-source/

3.docker

https://5greplay.org/docs/guide/docker/

命令

5Greplay命令使用以下形式:command [option]

  • command命令有以下几种:compile, info, list, extract, replay
  • option选项:运行”./5greplay command -h“以获取帮助,展示命令所有的选项
    在这里插入图片描述

(一)compile

此命令分析xml文件,然后编译成插件。即用户可以根据自己的需要编辑xml格式文件,生成自己的插件

该命令有3个参数:

1.输出位置:应该以结束.so或者.c当分别生成二进制或代码C时
2.包含要编译的规则的输入xml文件
3.可选择的-c以生成代码C或任何将被转移到gcc编译字符串。
为了能够编译规则,应该安装gcc:sudo apt install gcc

#to generate .so file
./5greplay compile rules/forward-localhost.so rules/forward-localhost.xml
#to generate code c (for debug)
./5greplay compile rules/forward-localhost.c rules/forward-localhost.xml -c

(二)info

该命令打印编译好的.so
文件的规则信息

该命令有一个可选参数。用于查看特定文件中的规则,不输入则默认输出rules文件夹下的所有规则。

#print information of all available plugins
./5greplay info
#print information of rules encoded in `rules/nas-smc-replay-attack.so`
./5greplay info rules/4.nas-smc-replay-attack.so

在这里插入图片描述
0.0.7版本内置了16种规则,不再一一列举,最初的0.0.1版本仅有3种
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

(三)list

该命令列出了5Greplay支持的所有协议及其属性。该命令没有参数。
可支持的协议特别多
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

(四)extract

该命令在0.0.2及之后的版本中可用。

它用于从pcap文件或网卡中提取给定协议的属性值。当我们想要查看pcap文件包中的内容时,可以使用该命令。

ubuntu22@ubuntu22-virtual-machine:~/5greplay-0.0.7$ ./5greplay extract -h
mmt-5greplay: 5Greplay v0.0.7-77dda18 using DPI v1.7.9 (8694eaa6) is running on pid 69299
extract [<option>]
Option:
-t <trace file>: Gives the trace file to analyse.
-i <interface> : Gives the interface name for live traffic analysis. Either -i or -t can be used but not both.
-p             : Protocol's name to be extracted. Default: ethernet
-a             : Attribute's attribute to be extracted. Default: src
-d             : Index of protocol to extract. For example: ETH.IP.UDP.GTP.IP, if d=3 (or ignored) IP after ETH, d=6 represent IP after GTP. Default: 0
-r             : ID of protocol stack. Default: 1
-h             : Prints this help then exit

(五)extract

该命令可以重放
通过捕获来自给定网卡的流量来提供实时流量,
或者保存在pcap文件中的流量。
在这里插入图片描述

ubuntu22@ubuntu22-virtual-machine:~/5greplay-0.0.7$ ./5greplay replay -h
mmt-5greplay: 5Greplay v0.0.7-77dda18 using DPI v1.7.9 (8694eaa6
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值