剑庭安
首页
黑客安全首页全部安全栏目 黑客技术黑客技术、渗透测试、漏洞利用工具与教程 安全软件安全工具、扫描器、检测与审计软件 病毒分析恶意软件分析、样本、逆向与沙箱 CTF思路CTF 题目、writeup、解题思路与工具 防护思路防御技术、加固、检测响应与蓝队 红蓝攻防红队攻击模拟、蓝队对抗、攻防演练 漏洞知识库漏洞、CVE、PoC、EXP 与安全研究
逆向|反编译
PHP源码PHP 网站源码、程序、系统 APP源码安卓/iOS APP 源码 ASP源码ASP 网站源码与程序 NET源码.NET 网站源码与系统 小程序源码微信/支付宝小程序源码 Dedecms风格模板Dedecms 织梦风格模板 Empirecms风格模板EmpireCMS 帝国风格模板 Discuz商业模板/插件Discuz 商业模板与插件 WordPress主题/插件WordPress 主题与插件 其它源码、模板其它各类源码与模板 游戏源码游戏源码与引擎项目 加密货币源码加密货币、区块链、钱包、USDT/比特币相关源码与工具 手游源码手机游戏源码、服务端、客户端与引擎项目 传奇源码热血传奇、传奇世界、复古传奇等客户端/服务端/引擎源码 页游源码网页游戏、H5 游戏、浏览器游戏源码 端游源码电脑单机游戏、PC 网游客户端/服务端源码
最新万能免驱动支持所有型号打印机下载程序 日历天气老黄历 · 每天同步真实日期与天气
站长工具站长工具 自助开通会员浏览该分类 其他资源qtziy SEO工具SEO工具 站群源码站群源码 泛程序泛程序 蜘蛛模板蜘蛛模板 蜘蛛池蜘蛛池 外链工具外链工具
搜索 自助开通会员🔓 破甲 API
登录 注册
首页 分类列表 防护思路 BlueTeam - Defensive Securit…
BlueTeam - Defensive Security Lab featuring a containerized M 防护思路 点击放大
作者:admin 发布:2026-10-06

BlueTeam - Defensive Security Lab featuring a containerized M

项目说明DriftLock — Blue Team MFA PortalDriftLock is a TOTP-based multi-factor authentication portal built as the Blue Team deli for a Red- Capture-the-Fl…
资源可下载 免费下载 0 条讨论
会员资源
开通会员后即可下载全部资源。
登录后开通会员
会员方案
277浏览量
0讨论
2下载链接
可下载资源状态
内容可验证
更新 2026-10-06
人工审核发布
评论区答疑

BlueTeam - Defensive Security Lab featuring a containerized M

项目说明

DriftLock — Blue Team MFA Portal

DriftLock is a TOTP-based multi-factor authentication portal built as the Blue Team deli for a Red- Capture-the-Flag exercise. It is a realistic web application, secured with genuine controls, that contains three deliberate, documented at increasing difficulty for the Red Team to discover — and is wrapped in logging, a honeypot, and an ELK monitoring stack so the Blue Team can detect and analyze the attack.

> Branch note: this is the main branch — the intentionally- CTF target. The remediated , with all findings fixed and , is on the patched branch.

---

What it does

Users register an account by pro a username, email address, and password. The system securely hashes the password using bcrypt. During registration, the user scans a QR code to complete the initial account setup.

When logging in, the user first enters their username (or email) and password. If the credentials are valid, the system generates a one-time password (OTP) and sends it to the user's registered email address.

For de and testing, MailHog is a at and acts as a dummy mail server. The user retrieves the OTP from MailHog and enters it to complete the login process. Authentication is successful only after both the password (something the user knows) and the emailed OTP (something the user receives) are .

TOTP here protects DriftLock's own login — one issuer, one secret per user (a 1:1 relationship). It is a login second factor, not a multi-service authenticator vault.

---

How it works (the security design)

DriftLock is a deliberately-defended target. Three layers make that work:

1. Realistic security controls. Password hashing (bcrypt), encrypted TOTP secrets (Fernet), input on registration, rate limiting (Flask-Limiter, backed by Redis), session-based authentication, and a two-step login (password then OTP) with protections against username enumeration and session fixation.

2. Three intentional . The app contains three deliberate, documented weaknesses at increasing difficulty: an unauthenticated /api/debug endpoint (information disclosure), TOTP code replay (no single-use enforcement), and an IDOR in a separate internal API (broken access control). Each is documented below so graders understand they were deliberate; e else is meant to be secure.

3. Self-monitoring / detection. Every request is logged. A honeypot ad a fake /backup_secrets/ folder .txt and fires a CRITICAL alert the instant anyone touches it. All logs flow through Logstash into Elasticsearch and are in Kibana, giving the Blue Team a live view for triage and incident response.

---

The detection loop

A single attack traces through every component:

Red Team packet -> app logs the request -> if it touches the honeypot or trips a detection, an alert fires -> Logstash ships the log into Elasticsearch -> Kibana surfaces it -> an analyst correlates the attacker's actions into one confirmed incident and separates it from benign noise -> that becomes the incident-response report.

---

Architecture

DriftLock runs as a set of Docker Compose services on one isolated lab network. Two Flask services — the web portal (:4325) and a separate, scannable internal-api (:5000) — share a single PostgreSQL database. The web service leans on Redis for rate limiting and lockout, and captures login OTP email through MailHog. Every request is written to JSON/plain log files, which Logstash mounts read-only and parses into Elasticsearch, where an analyst runs triage in Kibana.

Network exposure (host firewall)

The host firewall (ufw) allows only 22 (SSH), 4325 (web portal), and 5000 (internal-api) from the network. Kibana (5601) and MailHog (8025) are bound but not exposed externally — they are Blue Team tooling, reachable only on the host or via an SSH tunnel, so the attacking team cannot view the detection dashboards or captured mail. This is a deliberate defense-in-depth choice.

---

CTF Flag Submission & Leaderboard System

DriftLock includes a built-in CTF flag submission system with real-time leaderboard tracking, user progress management, and comprehensi logging. This allows Red Team members to submit captured flags, track their progress, and view rankings — while the Blue Team monitors all submission activity in ELK.

#### Features

  • Timestamp-based tracking: Every flag submission records the exact date and time

  • User progress history: Track which challenges each user has solved and when

  • Real-time leaderboard: Rank users by challenges solved, with per-challenge submission times

  • Submission timeline: Chronological feed of all flag submissions across all users

  • JSON API: Machine-readable submission data for custom dashboards

  • Audit logging: All submissions logged to access.log and detections.log for forensic analysis
  • #### Endpoints

    Endpoint Method Purpose
    /submit GET, POST Flag submission form + personal progress
    /leaderboard GET User rankings and submission history
    /api/submissions GET All submissions as JSON
    #### Quick Examples

    Components

    | Component | Port (host to container) | Role |
    |-----------|----------------------|------|
    | web (Flask) | 4325 | Main portal: registration, login, MFA, support, honeypot, /api/debug, CTF submission & leaderboard |
    | internal-api (Flask) | 5000 | Separate scannable service; hosts the IDOR |
    | db (PostgreSQL 16) | 5433 to 5432 (localhost only) | Shared database for both app services |
    | redis | 6379 (localhost only) | Rate-limit counters + login-lockout tracking |
    | mailpit (MailHog) | 1025 (SMTP), 8025 (UI, host-only) | Captures login OTP and reset emails in dev |
    | elasticsearch | 9200 | Log storage and search |
    | logstash | — | Parses log files, ships structured events to Elasticsearch |
    | kibana | 5601 (host-only) | Analyst dashboards for triage and incident response |

    Both app services share the same PostgreSQL database. All four log files are written under logs/ and mounted read-only into Logstash, which fans them out to Elasticsearch indices (see the ELK indices section).

    ---

    Tech stack

  • Backend: Python / Flask

  • Database: PostgreSQL

  • Cache / rate-limit store: Redis

  • TOTP: pyotp

  • Crypto: bcrypt (passwords), Fernet (TOTP seeds)

  • Monitoring: Elasticsearch, Logstash, Kibana (ELK)

  • Deployment: Docker Compose

  • App port: 4325 (web portal, non-standard per the brief)

  • Internal API port: 5000 (internal-api — separate service, disco by scan)

  • ---

    Running the project

    Local Python (de)

    Ne the ven.

    Full stack (Docker)

    Bring up the application services:

    Bring up the monitoring stack:

    #### Key endpoints once running:

  • App:

  • Internal API:

  • Kibana: (host-only)

  • Elasticsearch: (host-only)

  • MailHog (host-only)
  • #### CTF Submission Endpoints

  • Endpoint Method Purpose

  • /submit GET, POST Flag submission form + personal progress

  • /leaderboard GET User rankings and submission history

  • /api/submissions GET All submissions (JSON)
  • Example

    On Linux, Elasticsearch may require: sudo sysctl -w =262144

    Required en (.en)

  • DB_USER, DB_PASSWORD, DB_NAME — database credentials

  • MASTER_KEY — Fernet key encrypting TOTP seeds at rest

  • SECRET_KEY — Flask session signing key

  • ---

    Repository Structure

    #### CTF Submission System Configuration
    ##### En

    Add to .env file:

    ##### Valid Flags

    Edit web/app.py to configure valid flags:

    ##### Database Schema (Optional)

    To persist submissions to PostgreSQL instead of in-memory storage, add to db/init.sql:

    Then set CTF_PERSIST_TO_DB=true in .env.

    Branch differences

    ---

    Intentional (disclosure)

    DriftLock contains three deliberate, documented at increasing difficulty. All are intentional and disclosed here for grading.

    1 — EASY — IDOR / broken access control

  • Service: internal-api (port 5000 — a separate, scannable service)

  • Endpoint: GET /api/v1/users/<id>/setup-status

  • Type: Insecure Direct Object Reference — returns any user's account metadata when <id> is changed, with no authorization check

  • Exposes: another user's username, mfa_enabled status, and account creation time

  • Discovery / exploitation:
  • Enumerate user IDs (3, 4, 5, …) without authorization to read each user's record.

  • Detection: the service logs ID access; one source reading 3+ distinct IDs escalates to a CRITICAL idor_enumeration_suspected alert in ELK

  • Fix (production): authenticate the caller and enforce requested_id == caller_id, or use unguessable identifiers; do not expose internal APIs to untrusted networks
  • 2 — MEDIUM — Information disclosure

  • Endpoint: GET /api/debug (web, port 4325)

  • Type: Unauthenticated information disclosure

  • Exposes: Python , platform, en mode, and a hint pointing at the .env file

  • Discovery: reachable via port scan + path enumeration; no auth required

  • Detection: access is logged at WARNING and shipped to ELK

  • Fix (production): remove the endpoint or gate it behind authentication
  • 3 — HARD — Host Header Injection (password-reset poisoning)

  • Endpoint: POST /api/reset-password (web, port 4325)

  • Type: Host Header Injection — the password-reset link's base URL is built from the incoming Host header without

  • Exposes: an attacker who controls the Host header poisons the emailed reset link so it points at an attacker-controlled domain; a clicking it sends their reset token to the attacker (account-takeover risk)

  • Discovery / exploitation:
  • With an anomalous Host, the generated reset link points at the injected domain and carries a capturable flag (DRIFTLOCK{...}), retrievable from the reset email in Mailpit.

  • Detection: a Host header not matching the expected host is logged as HOST_HEADER_ANOMALY with the incoming host and source IP, and shipped to ELK

  • Fix (production): ne absolute URLs from the Host header — use a configured trusted base URL (APP_URL / EXPECTED_HOST) and the Host header against an allowlist
  • Disclosure note: These three are intentional CTF targets. Every other part of the application is meant to be secure — any weakness beyond these three is an accidental defect, not a planted target. (One additional finding — a hardcoded bearer token in /api/profile — was surfaced by the Red Team review and is documented as an additional finding; it is remediated on the patched branch.)

    ---

    ELK indices

  • driftlock-access-* — all HTTP access logs (web)

  • driftlock-honeypot-* — high-priority honeypot alerts

  • driftlock-internal-api-* — internal-api requests + IDOR enumeration alerts

  • driftlock-detections-* — replay / enumeration detection events
  • Monitoring CTF Submissions in Kibana

    Search driftlock-access-* for CTF activity:

    ---

    Reports

  • reports/01-design-report.md — architecture, security controls, rationale, Wireshark findings

  • reports/02-hardening-report.md — security implementations, defense-in-depth

  • reports/03-incident-response.md — attack e, detection method, log analysis, recommended fixes
  • ---

    Project status

    Complete: the defensi (honeypot, request logging, the ELK monitoring pipeline, the internal-api service, and the Docker deployment); the two-step login flow (password -> emailed OTP) with enumeration and session-fixation protections; and session-based authorization on sensiti. The three intentional are in place and documented. Remediation is demonstrated on the patched branch.

    ---

    CTF Submission System


  • Flag submissions are logged to access.log and a in Kibana for forensic analysis

  • By default, submissions are stored in-memory and lost on app restart; enable CTF_PERSIST_TO_DB for production use

  • All timestamps are in UTC; templates format for human display with strftime()

  • Disable the submission system by setting CTF_ENABLED=false in .env

  • Notes

    All testing and scanning must occur only within the isolated lab en.
    The ven and .env file must never be committed.

    ---

    License

    This project is licensed for research and educational purposes only.

    项目信息

    开发语言:HTML

    Star 数:2

    技术要点

    该项目属于防护思路方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕Defensive Security Lab featuring a containerized MFA portal, centralized ELK logging, and automated threat detection.展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。

    从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。

    使用与学习建议

    1. 下载源码压缩包,解压到本地环境。

    2. 根据项目类型准备对应的运行环境与依赖。

    3. 按照 README 中的步骤完成配置与部署。

    4. 在隔离的测试环境中运行验证,避免影响生产系统。

    免责声明

    本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。

    资源标题BlueTeam - Defensive Security Lab featuring a containerized M
    所属分类防护思路
    发布作者admin
    发布时间2026-10-06 00:19:25
    下载权限 免费下载
    附件数量2 个下载链接
    浏览次数277
    讨论数量0
    主题状态正常讨论中

    本资源免费,登录后即可在本页「下载链接」区域获取全部附件。

    请在评论区留言说明具体链接,或联系作者补档。楼主更新后本页会同步最新的下载地址。

    请先阅读正文中的授权说明;未注明的默认仅限站内学习交流,禁止直接搬运到其他站点二次售卖。
    还没有讨论,快来抢沙发~
    登录 后才能参与讨论
    下载链接
    会员才能下载
    登录后开通会员
    同分类推荐
    暂无同类资源
    免费登录即可下载
    查看会员
    放大预览

    © 2026 剑庭安 - 网站开发定制 SEO 优化蜘蛛池代做 在线看手相算命. 保留所有权利。

    Powered by 酷像SEOv3.0

    网站地图 Sitemap.xml
    首页 全部分类 黑客安全 逆向|反编译 精品源码 站长工具自助开通会员其他资源SEO工具站群源码泛程序蜘蛛模板蜘蛛池外链工具创意乐园 搜索 会员服务 登录 注册