About me
Blog
Europe/Berlin
--:--:--
Projects

IoT Security Training Kit (ESP32)

September 3, 2025
CTF-style training box for secure embedded development. Take teams from "we know security matters" to practically demonstrated competence in 1–2 days: identify, exploit in a controlled manner, measure, and harden vulnerabilities – directly on the ESP32.
⚠️ All vulnerabilities are intentionally implemented and intended exclusively for lab scenarios. Not for use in production.

  • Hands-on instead of slides: 10 real IoT attack surfaces (HTTP, MQTT, OTA, UART, BLE, Storage, RNG, Logging) on real hardware.
  • Before/after visibility: Switchable build mode (Vulnerable vs. Fixed) with clear measurement criteria and PoV tests.
  • Practical setup: Docker services (MQTT, OTA/Web, Scoring), PoV scripts, and CI checks – ready to use immediately.
  • Scalable: Team CTF with flag submission, trainer guides, extensible with custom scenarios (e.g., signed OTA pipelines, SBOM).
Target audience: Embedded developers, Test/QA, Security Champions, DevOps/IoT Ops. Duration: 1–2 days (intensive), optional follow-up (hardening sprints). Prerequisites: Basic knowledge of C/ESP-IDF, Docker, networking basics.
  • 10 Challenges with clear learning objectives (see below)
  • Build switch: BUILD_FIXED=1 activates hardening (immediately shows the effect)
  • Clean separation: Exploit-free PoV scripts demonstrate risks without "weaponization"
  • Trainer material: Syllabus, solution guides, facilitation roadmap, scoring server
  • CI-ready: Example workflow (Static Analysis/Tree), easily extensible (SAST/Secrets scan)

  • Firmware (ESP-IDF v5.x) with 10 modules (HTTP server, MQTT client, BLE GATT, UART CLI, OTA handler, KV store, etc.)
  • Docker Compose: Mosquitto (MQTT), lightweight OTA/Web server, optional scoring server
  • PoV tools (Python) + requirements, example commands
  • Documentation: Setup, syllabus, challenges (description → PoV → fix → success criteria), facilitation guide
  • CI workflow (.github/workflows) as a starting point for your pipeline

After the training, participants can…
  • systematically identify and prioritize IoT attack surfaces,
  • demonstrably identify insecure defaults, weak tokens/PRNG, and unencrypted communication,
  • securely design the OTA path (download → verification → commit) (TLS, signature, anti-rollback, verify-before-commit),
  • specifically find and fix memory/protocol errors (overflow, format string, missing bounds checks),
  • properly apply BLE permissions (pairing/encryption, attribute permissions),
  • configure log/KV storage so that secrets do not "leak."

  1. Default Credentials (HTTP Basic) PoV: Login with default credentials. Fix: Disable Basic auth, short-lived tokens + TLS, never hardcode secrets.
  2. Insecure MQTT (without TLS/Auth) PoV: Publish/Subscribe without auth; command abuse. Fix: TLS, username/password, topic isolation, authorization, QoS/retain rules.
  3. Weak Token (PRNG) PoV: Predictable session tokens (rand() with fixed seed). Fix: TRNG/DRBG (esp_random), nonces, rate limits.
  4. Command Injection (simulated) & Logging PoV: Unvalidated cmd parameter → log format/buffer issues. Fix: Whitelist, safe formatting, bounds checks.
  5. UART Overflow PoV: Unchecked copy → out-of-bounds write. Fix: Length validation, strlcpy/memcpy_s, fuzzing on UART paths.
  6. Unsigned/Plain OTA PoV: OTA from http:// without signature verification. Fix: HTTPS, signature before commit, anti-rollback, hash verification after writing.
  7. BLE Insecure Permissions PoV: Read/write without pairing/encryption. Fix: Tighten GATT permissions, bonding, secure connections.
  8. Plaintext Provisioning & Secret Logging PoV: KV store/logs contain passwords. Fix: Redaction, NVS encryption, never log secrets.
  9. Sensitive Data in NVS PoV: Unencrypted NVS dump. Fix: Enable NVS encryption, key management.
  10. Insecure Update Channel (TOCTOU) PoV: Time window between check and application. Fix: Atomic "verify-before-commit" strategy, post-write hash, A/B rollback.
Each challenge is documented as Markdown (description → PoV → fix → verification).
[Participants] ──(HTTP/MQTT/BLE/UART)──> [ESP32 DevKit]
      │                                   │
      ├───────────────(MQTT)──────────────┤
      │                                   ▼
   [Docker: Mosquitto]              [Docker: OTA/Web]
      │                                   │
      └──────────────(HTTP/REST)──────────┘
                        │
                 [Scoring Server]
Build Modes:
  • Vulnerable (Default): Vulnerabilities active, PoVs work.
  • Fixed: Hardening active → PoVs fail; logs/checks show "clean" behavior.

  • Target: ESP32 DevKit (ESP32-WROOM32/equivalent)
  • ESP-IDF: v5.x (HTTP Server, MQTT Client, BLE GATT, NVS, OTA)
  • Partitioning: A/B-capable (factory, ota_0, ota_1); rollback support activatable
  • Docker: Mosquitto (MQTT, 1883), OTA/Web (Flask, 8000), optional Scoring (5050)
  • PoV Tools: Python 3.10+ (requests, paho-mqtt)
  • CI Skeleton: Cppcheck + structure, easily extensible (SAST, secret scan, lint)

Day 1
  1. Setup & Recon (nmap, MQTT sub, BLE scan)
  2. HTTP/MQTT Challenges (#1, #2, #3)
  3. UART Overflow (#5) incl. logic analyzer insight
Day 2 4) OTA chain (#6 & #10) – risks & secure variants 5) BLE permissions (#7) 6) Storage/Logging (#8 & #9) 7) Hardening build (BUILD_FIXED=1), regression check, retrospective Scoring: Team CTF via scoring server (flag submission, light point weighting).
  • Signed OTA Pipeline (ESP32/STM32): seamless integration of an Ed25519-based update chain (manifest, verify-before-commit, anti-rollback).
  • SBOM & Supply Chain: CycloneDX in CI, release signatures (cosign), reproducible builds.
  • Device-specific Scenarios: CAN gateway, industrial protocols, sensors with Wheatstone bridge examples.

  • The kit is operated exclusively in isolated lab environments (dedicated SSID/VLAN).
  • PoV scripts target only the provided hardware/containers.
  • No publication of production-grade exploits or 0-days.

Basic • Complete kit (repo, Docker, docs, PoV, CI skeleton) • Remote onboarding (2h) Pro • Basic + 1-day workshop (trainer) • Customization for your lab (network, certificates, policies) Enterprise • Pro + custom challenges (your protocols/hardware) • SBOM/Signed OTA integration, security reviews Price: on request.
Is this dangerous? No – the environment is isolated. PoVs are deliberately "tame" and target only the lab components. Do we need special hardware? A standard ESP32 DevKit is sufficient. Optional logic analyzer for the UART challenge. Can we add our own scenarios? Yes. The repository is modular – new endpoints/protocols can be cleanly added. How do you measure learning success? Through flags, automated checks in the fixed build, and a short final assessment (multiple choice + mini PoV).
Bash
# Firmware (Vulnerable)
idf.py -C firmware/esp32 set-target esp32
idf.py -C firmware/esp32 build && idf.py -C firmware/esp32 flash monitor

# Firmware (Fixed)
idf.py -C firmware/esp32 build -D BUILD_FIXED=1

# Docker Services
docker compose -f docker/docker-compose.yml up -d

# PoV: Default Credentials
python tools/pov_default_creds.py http://<ESP32-IP>/login

# PoV: Insecure MQTT
python tools/pov_insecure_mqtt.py

Interested in a live demo or an in-house workshop? Inquire now: info@buengener-software.de
Meta Title: IoT Security Training Kit (ESP32) – CTF Training for Embedded Teams Meta Description: CTF-style training box for secure embedded development: 10 IoT challenges (HTTP, MQTT, OTA, BLE, UART), PoV scripts, Docker lab, CI skeleton. Get practice-ready in 1–2 days. JSON-LD (Course/Service)
Html
<script type="application/ld+json">
  {
    "@context": "https://schema.org",
    "@type": "Course",
    "name": "IoT Security Training Kit (ESP32)",
    "description": "CTF-style hands-on training for secure embedded development on ESP32.",
    "provider": {
      "@type": "Organization",
      "name": "Büngener Software",
      "url": "https://buengener-software.de"
    },
    "hasCourseInstance": {
      "@type": "CourseInstance",
      "courseMode": "OnSite/OnLine",
      "startDate": "2025-10-01",
      "endDate": "2025-12-31",
      "location": {
        "@type": "Place",
        "name": "In-house / Remote"
      }
    }
  }
</script>

  • v1.0 – Initial release of the Training Kit (10 challenges, Docker lab, PoV, CI skeleton)
MIT (for reference code; third-party libraries may have their own licenses).