ammaduddinbajwa/5G-Threat-Detection-Simulation-AWS
GitHub: ammaduddinbajwa/5G-Threat-Detection-Simulation-AWS
在 AWS 上使用 Open5GS 与 srsRAN 模拟私有 5G 网络,通过发起真实攻击场景来评估 Amazon GuardDuty 威胁检测能力的网络安全论文项目。
Stars: 1 | Forks: 0
# AWS 上的 5G 威胁检测模拟





网络安全硕士论文项目(爱尔兰国立学院):一个在 AWS 上构建的模拟私有 5G 网络,用于评估 Amazon GuardDuty 检测针对电信基础设施的真实攻击的能力。
**概览**
- 在 AWS 上模拟了完整的私有 5G 协议栈 —— Open5GS 核心网 + srsRAN 无线接入网 (RAN) —— 跨越专用的多子网 VPC。
- 针对该环境发起了真实的攻击场景(端口/网络扫描、SSH 暴力破解、DNS 外泄)。
- Amazon GuardDuty 记录了 **350 多项发现**,包括高严重性的 **TorRelay** 和 **DNS 外泄**活动,涵盖 UnauthorizedAccess: unauthorized access、Recon 和 PrivilegeEscalation 类别。
- 完整的详细说明、方法论和截图请见 [final.pdf](final.pdf)。
## 概述
本项目演示了如何在 Amazon Web Services (AWS) 上设置模拟的私有 5G 网络,以评估 Amazon GuardDuty 的实时威胁检测能力。该环境使用 Open5GS 提供核心网功能,并使用 srsRAN 进行无线接入网 (RAN) 模拟。它包含了针对威胁模拟场景的配置,例如网络扫描、暴力破解和 DNS 外泄,以测试 GuardDuty 的检测准确性、响应时间和性能开销。
此设置提供了一个安全、云原生的测试平台,用于将 5G 网络与 AWS 安全服务集成,非常适合探索现代电信基础设施中的网络安全。
**展示的核心技能:**
- AWS 服务(EC2、VPC、GuardDuty、CloudTrail、VPC Flow Logs)
- 5G 网络模拟(Open5GS、srsRAN)
- 网络安全与威胁模拟(nmap、SSH 暴力破解、DNS 外泄)
- Linux 系统管理(Ubuntu、Amazon Linux)
- DevOps 工具(Git、Meson、Ninja、CMake)
## 系统要求
### 硬件要求
| 组件 | 实例类型 | 存储 | 操作系统 | 网络 CIDR | 子网 |
|---------------|---------------|--------------|------------------------|--------------|------------------|
| 核心实例 | t2.medium | 20 GiB (gp2) | Ubuntu Server 20.04 LTS| 10.0.0.0/16 | Core: 10.0.1.0/24|
| RAN 实例 | t2.medium | 20 GiB (gp2) | Ubuntu Server 20.04 LTS| 10.0.0.0/16 | RAN: 10.0.2.0/24 |
### 软件要求
| 组件 | 必需软件 |
|---------------|---------------------------------------|
| 核心实例 | Open5GS, MongoDB, build-essential, meson, ninja-build |
| RAN 实例 | srsRAN, libuhd-dev, cmake, gcc |
### 依赖项
| 组件 | 必需工具 |
|---------------|------------------|
| 核心实例 | net-tools, curl |
| RAN 实例 | nmap, iperf3 |
### AWS 服务与策略
- **IAM 策略:** AmazonEC2FullAccess, AmazonVPCFullAccess, AmazonGuardDutyFullAccess, CloudWatchLogsFullAccess
- **网络:** 带有 Internet Gateway 的 VPC,用于 Core 和 RAN 子网的 Security Groups
## 设置说明
按照以下步骤重现该环境。有关详细的复现信息,请参阅 [附录](#appendix-detail-instructions-for-result-reproduction) 或附带的 [final.pdf](final.pdf)。
### 1. 创建 VPC 和子网
- VPC:MVP-5G-VPC (CIDR: 10.0.0.0/16)
- 核心子网:MVP-5G-Core-Subnet (CIDR: 10.0.1.0/24)
- RAN 子网:MVP-5G-RAN-Subnet (CIDR: 10.0.2.0/24)
### 2. 创建并附加 Internet Gateway
- Internet Gateway:MVP-5G-IGW 附加到 MVP-5G-VPC
### 3. 配置路由表
- 核心路由表:MVP-5G-Core-RT,路由 0.0.0.0/0 指向 MVP-5G-IGW,关联至 MVP-5G-Core-Subnet
### 4. 启动 EC2 实例
- **核心实例:** MVP-5G-Core-Instance (Amazon Linux 2, t2.micro, MVP-5G-Core-Subnet, 安全组:SSH 22, HTTP 80)
- **RAN 实例:** MVP-5G-RAN-Instance (Amazon Linux 2, t2.micro, MVP-5G-RAN-Subnet, 安全组:SSH 22, 自定义 TCP 8080)
### 5. 在核心实例上安装并配置软件
- SSH 登录核心实例:`ssh -i AmmadMVPKeyPair.pem ec2-user@`
- 更新:`sudo yum update -y`
- 安装 Apache:`sudo yum install httpd -y`
- 启动 HTTP:`sudo systemctl start httpd && sudo systemctl enable httpd`
- 创建网页:`echo "`
- 更新:`sudo yum update -y`
- 安装 curl:`sudo yum install curl -y`
对于 srsRAN 设置:
- 安装依赖:`sudo apt install -y git build-essential cmake libconfig++-dev`
- 克隆并构建:`git clone https://github.com/srsran/srsRAN.git && cd srsRAN && mkdir build && cd build && cmake ../ && make && sudo make install`
- 配置 gNB:编辑 `/usr/local/etc/srsran/gnb.conf` 设置核心 IP
- 启动 UE 模拟器:`sudo srsue`
### 7. 模拟网络流量和威胁
- 从 RAN 到核心:`curl http://` 或循环:`while true; do curl http://; sleep 1; done`
- 安装 nmap:`sudo yum install nmap -y`
- 端口扫描:`nmap -sS -Pn `
- SSH 暴力破解:`ssh ec2-user@` (模拟失败的尝试)
- DNS 外泄:`sudo yum install bind-utils -y && dig baddomain.example.com && nc -zv 23-25`
### 8. 启用并监控 GuardDuty
- 在 AWS Console 中启用 GuardDuty
- 监控已检测威胁的发现结果(例如:TorRelay、Recon、UnauthorizedAccess: unauthorized access)
## 结果
- GuardDuty 检测到 350 多项发现,包括 TorRelay 和 DNS 外泄等高严重性威胁。
- 常见发现类型:UnauthorizedAccess: unauthorized access、Recon、PrivilegeEscalation。
- [final.pdf](final.pdf) 中提供了图表和摘要,展示了严重性分布和攻击详情。
## 参考文献
1. Open5GS 仓库:https://github.com/open5gs/open5gs
2. MongoDB 社区版:https://www.mongodb.com/docs/manual/installation/
3. srsRAN 仓库:https://github.com/srsran/srsRAN
4. Ubuntu Server 20.04 LTS:https://ubuntu.com/download/server
5. 构建工具:https://packages.ubuntu.com/
6. Meson 构建系统:https://mesonbuild.com/
7. Ninja 构建系统:https://ninja-build.org/
8. BIND 工具 (dig):https://linux.die.net/man/1/dig
9. Netcat (nc):https://netcat.sourceforge.net/
## 附录:结果复现的详细说明
| 说明 | 代码/输出 |
|--------------|-------------|
| 使用 Root 权限 | - 访问类型:AWS Management Console access
- 策略:AmazonEC2FullAccess, AmazonVPCFullAccess, AmazonGuardDutyFullAccess, CloudWatchLogsFullAccess | | 创建 VPC 模拟 5G 网络 | MVP-5G-VPC
10.0.0.0/16 | | 核心子网 | MVP-5G-Core-Subnet
10.0.1.0/24 | | RAN 子网 | MVP-5G-RAN-Subnet
10.0.2.0/24 | | 创建并附加 Internet Gateway | MVP-5G-IGW
MVP-5G-VPC | | 配置路由表 | MVP-5G-Core-RT
目标 0.0.0.0/0 → 下一跳 MVP-5G-IGW
MVP-5G-Core-Subnet | | 启动 EC2 实例 | 核心:MVP-5G-Core-Instance, Amazon Linux 2, t2.micro, MVP-5G-Core-Subnet, SSH(22), HTTP(80)
RAN:MVP-5G-RAN-Instance, Amazon Linux 2, t2.micro, MVP-5G-RAN-Subnet, SSH(22), 自定义 TCP(8080) | | ... (完整附录见 PDF) | ... | 有关包含截图和详细输出的完整指南,请下载 [final.pdf](final.pdf)。 此设置展示了对云安全、5G 技术和威胁建模的实践经验——非常适合网络安全、云工程或电信领域的职位。欢迎联系合作! **Ammad Ud Din Bajwa** — 网络安全硕士,爱尔兰国立学院 · SOC Analyst | Incident Response | Cybersecurity Operations [LinkedIn](https://www.linkedin.com/in/ammaduddinbajwa) · [GitHub](https://github.com/ammaduddinbajwa) · ammaduddinbajwa702@gmail.com
MVP 5G Core Instance
" > /var/www/html/index.html` 对于 Open5GS 设置(在 Ubuntu 实例上): - 安装依赖:`sudo apt install -y build-essential meson ninja-build ...` (完整列表见 PDF) - 克隆并构建 Open5GS:`git clone https://github.com/open5gs/open5gs.git && cd open5gs && meson build --prefix=`pwd`/install && ninja -C build install` - 启动 MongoDB:`sudo apt install -y mongodb && sudo systemctl start mongodb` - 添加订阅者:`./open5gs-dbctl add 001010123456789 123456789012345` - 启动服务:`./open5gs-mmed & ./open5gs-smfd & ...` ### 6. 在 RAN 实例上安装并配置软件 - SSH 登录 RAN:`ssh -i AmmadMVPKeyPair.pem ec2-user@- 策略:AmazonEC2FullAccess, AmazonVPCFullAccess, AmazonGuardDutyFullAccess, CloudWatchLogsFullAccess | | 创建 VPC 模拟 5G 网络 | MVP-5G-VPC
10.0.0.0/16 | | 核心子网 | MVP-5G-Core-Subnet
10.0.1.0/24 | | RAN 子网 | MVP-5G-RAN-Subnet
10.0.2.0/24 | | 创建并附加 Internet Gateway | MVP-5G-IGW
MVP-5G-VPC | | 配置路由表 | MVP-5G-Core-RT
目标 0.0.0.0/0 → 下一跳 MVP-5G-IGW
MVP-5G-Core-Subnet | | 启动 EC2 实例 | 核心:MVP-5G-Core-Instance, Amazon Linux 2, t2.micro, MVP-5G-Core-Subnet, SSH(22), HTTP(80)
RAN:MVP-5G-RAN-Instance, Amazon Linux 2, t2.micro, MVP-5G-RAN-Subnet, SSH(22), 自定义 TCP(8080) | | ... (完整附录见 PDF) | ... | 有关包含截图和详细输出的完整指南,请下载 [final.pdf](final.pdf)。 此设置展示了对云安全、5G 技术和威胁建模的实践经验——非常适合网络安全、云工程或电信领域的职位。欢迎联系合作! **Ammad Ud Din Bajwa** — 网络安全硕士,爱尔兰国立学院 · SOC Analyst | Incident Response | Cybersecurity Operations [LinkedIn](https://www.linkedin.com/in/ammaduddinbajwa) · [GitHub](https://github.com/ammaduddinbajwa) · ammaduddinbajwa702@gmail.com
标签:5G网络, AMSI绕过, AWS, Bash脚本, DPI, Open5GS, srsRAN, 威胁检测, 安全实验环境, 插件系统, 漏洞利用检测, 网络安全, 隐私保护, 预握手