DevOpsMadDog/pentest-lab

GitHub: DevOpsMadDog/pentest-lab

基于 AWS 的一站式渗透测试学习实验室,通过 Terraform 一键部署漏洞靶场并提供完整的两天培训课程。

Stars: 0 | Forks: 0

# 渗透测试实验室 [![security-checks](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/a538b21ef7154509.svg)](https://github.com/DevOpsMadDog/pentest-lab/actions/workflows/security-checks.yml) ![license](https://img.shields.io/badge/license-Apache--2.0-blue) ## 👉 新来的?先读这个 **[START-HERE.md](START-HERE.md)** — 为你(管理员 / 引导员 / 参与者 / 赞助商)挑选正确的路径,并为你提供线性的阅读顺序。 如果你不知道自己是管理员还是引导员:**请阅读 START-HERE.md。** 它会告诉你答案。 ## 这个仓库实际包含什么 一个仓库包含两个产品。你可以只运行 #1 而不运行 #2。但如果没有 #1,你就无法运行 #2。 ### 1. AWS 中的学习实验室 在你的开发 VPC 中运行的单个 EC2 实例: - **Juice Shop**、**DVWA**、**bWAPP** — 三个针对 OWASP Top 10 故意留下漏洞的 Web 应用 - **DonkeyDocker** ×40 — 每个参与者一个 CTF 容器 (web shell → SSH → 权限提升 → Docker 逃逸) - 基于 **AWS Bedrock** 的 **PentAGI** — 参与者可以驱动的 AI 渗透测试 agent - **Langfuse** — 追踪每一次 AI 调用,让你了解它的推理过程 - 端口 9000 上的 **Dashboard** — 状态、团队、OWASP 热力图、排行榜、成本 通过 **SSM port-forwarding** 访问:没有公网 IP,没有 SSH 密钥,没有 VPN。 使用一次 `terraform apply` 搭建。使用一次 `terraform destroy` 销毁。 ### 2. 面向约 30 名工程师的 2 天现场黑客马拉松 - 第一天:基础知识、OWASP Top 10 简介、纸质攻击树练习、实操热身 - 第二天:团队 CTF(3 轮)、AI 辅助挑战、洞察画布、闪电演讲、颁奖 - 产出:每个团队签署的具体 DevSecOps 待办事项列表 — 安全编码规则、CI/CD 卡点、云基线,全部包含负责人和日期 ## 贯穿这个仓库的单一途径 ``` START-HERE.md │ ▼ docs/GLOSSARY.md ← decode every acronym (10 min) │ ▼ docs/LEARN-FIRST.md ← facilitator warm-up (2–4 hrs, week before) │ ▼ docs/SETUP.md ← admin stands up the lab (90 min, one time) │ ▼ docs/FACILITATOR-GUIDE.md ← runbook for the 2 days │ ▼ hackathon/BLUEPRINT.md ← the design doc │ ▼ hackathon/day1/ → hackathon/day2/ → hackathon/templates/ ``` 仓库中的其他所有内容(`terraform/`、`dashboard/`、`cli/`、`prompts/`、`scripts/`)都是 **runtime** — 即你运行的代码,而不是你需要从头到尾阅读的文档。 ## 按角色划分的快速链接 | 你是… | 阅读 | |---|---| | 首次访问者 | [START-HERE.md](START-HERE.md) | | 搭建实验室的管理员 | [docs/SETUP.md](docs/SETUP.md) | | 运营活动的引导员 | [docs/FACILITATOR-GUIDE.md](docs/FACILITATOR-GUIDE.md) | | 第一天上午的参与者 | [docs/DEV-ONBOARDING.md](docs/DEV-ONBOARDING.md) | | 审批支出的赞助商 | [hackathon/BLUEPRINT.md](hackathon/BLUEPRINT.md) + [SETUP.md](docs/SETUP.md) 中的成本部分 | | 对缩写感到困惑 | [docs/GLOSSARY.md](docs/GLOSSARY.md) | ## 实验室中运行的内容 — 概览 | 服务 | 目的 | 每个开发者还是共享? | 本地 URL(运行 `dev-connect.sh` 后) | |---|---|---|---| | **DonkeyDocker** | CTF:web shell → SSH → Docker 权限提升至宿主机 | 每个开发者一个 | `http://localhost:8001` + `ssh smith@localhost -p 22001` | | **OWASP Juice Shop** | 现代的漏洞 Web 商店,约 100 个评分挑战 | 共享 | `http://localhost:3000` | | **DVWA** | 经典的 PHP/MySQL 应用,带有并排的修复方案 | 共享 | `http://localhost:4280` | | **bWAPP** | 100 多个映射到 OWASP Top 10 的漏洞 | 共享 | `http://localhost:4281` | | **PentAGI** | 使用 AWS Bedrock 的 AI 渗透测试 agent ([github](https://github.com/vxcontrol/pentagi)) | 共享,多用户 | `https://localhost:8443` | | **Langfuse** | LLM 调用追踪 — 查看 AI 做了什么 | 共享 | `http://localhost:4000` | | **Dashboard** | 状态、团队、OWASP 热力图、成本 | 共享,仅限管理员 | `http://localhost:9000` | 全部通过 **SSM port-forwarding** 访问 — 没有公网 IP,没有 SSH 密钥,没有 VPN。 ## 部署(TL;DR — 完整版本在 [SETUP.md](docs/SETUP.md) 中) ``` # 前置条件(参见 SETUP.md §0):准备好 VPC IDs,已启用 Bedrock model 访问权限,已安装 SSM plugin git clone https://github.com/DevOpsMadDog/pentest-lab.git cd pentest-lab/terraform # 配置 cp variables.example.tfvars terraform.tfvars $EDITOR terraform.tfvars # fill in vpc_id, subnet IDs, dev_count # 应用 terraform init terraform apply # 等待约 15 分钟以执行 user-data,然后 port-forward dashboard INSTANCE_ID=$(terraform output -raw instance_id) aws ssm start-session --target $INSTANCE_ID \ --document-name AWS-StartPortForwardingSession \ --parameters 'portNumber=["9000"],localPortNumber=["9000"]' open http://localhost:9000 ``` ## 仓库地图 ``` pentest-lab/ ├── START-HERE.md ⭐ read first ├── README.md ← you are here │ ├── docs/ ← all explanatory writing, read in this order: │ ├── GLOSSARY.md ← 1. decode acronyms │ ├── LEARN-FIRST.md ← 2. facilitator warm-up │ ├── SETUP.md ← 3. admin: stand up the lab │ ├── FACILITATOR-GUIDE.md ← 4. how to run the 2 days │ ├── DEV-ONBOARDING.md ← participant connect guide │ ├── COURSE.md ← optional pre-reading │ └── INSTRUCTOR-RUNSHEET.md ← legacy (superseded by FACILITATOR-GUIDE) │ ├── hackathon/ ← the 2-day event content │ ├── BLUEPRINT.md ← design rationale │ ├── day1/ ← morning intro + paper exercise │ ├── day2/ ← CTF rules + awards script │ ├── judging/ ← scoring rubric │ └── templates/ ← insights canvas + lightning talk │ ├── terraform/ ← AWS infrastructure (one-time apply) ├── scripts/ ← dev-connect.sh + admin cheatsheet ├── cli/lab ← `lab up | adddev | grade | cost | …` ├── dashboard/ ← FastAPI + browser SPA (port 9000) ├── prompts/ ← 13 pre-baked PentAGI tasks └── .github/workflows/ ← CI: tflint, tfsec, checkov, gitleaks, semgrep, … ``` ## 成本 | 模式 | 成本 | |---|---| | 实验室 24/7 运行 | ~AUD 600/月 | | **在工作日晚上/周末自动停止的实验室** | **~AUD 340–490/月** | | 活动间隙销毁实验室 | ~AUD 0(重新 apply 需要 15 分钟) | | 每个培训日 | ~AUD 60–110 | | Bedrock token 消耗 | 每次会话 ~AUD 5–20 | 有关明细,请参阅 [SETUP.md 成本部分](docs/SETUP.md#cost--whats-the-bill)。 ## 这个仓库故意 **不** 做什么 - **不暴露在公共互联网上。** 所有内容都在开发 VPC 内部。没有 `0.0.0.0/0` 安全组规则。如果你想要一个公开的 CTF,这个仓库不适合你。 - **没有生产数据。** 每个目标都是故意留下漏洞的软件。不要将其指向任何真实的系统。 - **不提供 AI 密钥。** Bedrock 通过实例角色访问。如果你想直接使用 OpenAI/Anthropic,请参阅 PentAGI 的文档并设置你自己的密钥存储。 - **不对目标本身进行 CI。** 故意留下漏洞的应用会无法通过现存的所有安全扫描器。此仓库中的 CI 扫描的是 **我们的** 代码(Terraform、dashboard、脚本)。 ## 许可证 Apache 2.0 — 参见 [LICENSE](LICENSE)。 带有漏洞的应用(Juice Shop、DVWA、bWAPP、DonkeyDocker)保留其原始许可证。仅在包含的开发 VPC 中自担风险使用。 **从 [START-HERE.md](START-HERE.md) 开始。**
标签:AI安全, AWS, Chat Copilot, DevSecOps, DPI, ECS, Terraform, 上游代理, 漏洞修复, 网络安全培训, 请求拦截, 逆向工具, 靶场环境