Chuyển đến nội dung

Bài 27 · Security and Privacy

IoT Threat Modeling: What Can Go Wrong

Learn to think like a defender: map the IoT attack surface, apply STRIDE, study classic failures like default passwords, and run a configuration auditor.

An IoT device is a small computer that lives for ten years, sits in a place nobody checks, speaks to the internet and often controls something physical. That combination makes security harder than for a laptop: devices are cheap, rarely patched, physically reachable by attackers, and compromised devices can open doors, stop pumps or join botnets that take down websites. A famous example is the Mirai botnet of 2016, built mostly from cameras and routers that still used factory-default passwords.

The way to start is threat modeling: a structured look at what you are protecting, who might attack and how, before choosing defenses. This lesson gives you the method; the next lessons cover identity and encryption and updates and privacy.

Everything here is for defending your own systems. The examples audit configuration data; they do not scan or attack anything.

Step 1: Know your assets and boundaries

List what is valuable: sensor data (privacy), control commands (safety), credentials and keys, firmware (intellectual property and integrity), and the device's reputation and availability. Then draw the trust boundaries: places where data passes from one level of trust to another.

flowchart LR
  D["Device<br/>(physically exposed)"] -- "Wi-Fi / cellular" --> G["Gateway"]
  G -- "Internet" --> B["Broker / Cloud"]
  B --> A["Web and mobile app"]
  U(("User")) --> A
  X(("Attacker")) -.-> D
  X -.-> G
  X -.-> B
  X -.-> A

Every arrow is an interface an attacker can listen on, replay on or tamper with.

Step 2: The attack surface

The attack surface is the sum of everything an attacker can touch. For IoT it spans:

Layer Examples of weakness
Hardware open debug ports (UART, JTAG), readable flash, extractable keys
Firmware hard-coded secrets, buffer overflows, no signature check on updates
Network unencrypted protocols, open ports, weak Wi-Fi setup
Cloud/API broken access control, shared credentials, no rate limiting
Mobile/web app insecure pairing, token leaks, weak password reset
People default passwords, phishing, lost phones

Step 3: STRIDE

STRIDE is a checklist of six threat kinds. For each interface ask which could apply.

STRIDE, part 1

Spoofing Pretending to be a device or server
Tampering Changing data or firmware
Repudiation Denying an action, no logs
1 / 2

Example for one interface, a device publishing temperature to the broker:

  • Spoofing: someone connects with the device's client ID and publishes fake readings. Defense: per-device credentials or certificates.
  • Tampering: a man in the middle alters the value. Defense: TLS.
  • Information disclosure: a neighbor subscribes to #. Defense: topic access control lists.
  • Denial of service: a flood of messages fills the broker. Defense: rate limits and quotas.
  • Elevation of privilege: a temperature sensor can also publish commands to the door lock. Defense: least privilege per topic.
  • Repudiation: no log says who unlocked the door. Defense: audit logging with device identity.

Common IoT failures

  1. Default or shared credentials. One password for a whole product line means one leak compromises everything.
  2. Hard-coded secrets in firmware. Anyone who downloads the firmware reads them.
  3. No encryption, or encryption with certificate checks disabled "to make it work".
  4. Unauthenticated services left running (telnet, a debug web server, an open MQTT broker).
  5. No update path, so known bugs stay forever.
  6. Over-collection of data, then a breach exposes it.
  7. Insecure pairing: a setup Wi-Fi network with no password, or a Bluetooth pairing without confirmation.

Auditing a fleet configuration

Many of these failures are visible in configuration data. The program below checks a device inventory against rules and prints a risk score. It is a pure data check, which is how real compliance scanners start.

Node.js A simple IoT configuration auditor

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Real scores use frameworks such as CVSS, but the idea is the same: turn vague worries into a ranked to-do list.

Throttling guesses

One cheap defense against password guessing is to slow the attacker down: count failures per source and lock out temporarily. The simulation below shows exponential back-off.

Node.js Lockout with exponential back-off

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Slowing guesses never replaces strong, unique credentials, but it makes bulk guessing impractical.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. In STRIDE, an attacker connecting with a stolen client ID and sending fake readings is an example of:

    The attacker pretends to be a legitimate device, which is spoofing identity.
  2. 2. Why are factory-default passwords a particular IoT risk?

    Default credentials are public knowledge, and automated scanners try them against every reachable device.
  3. 3. What is a trust boundary?

    Threat modeling focuses on these crossing points because that is where checks are needed.
  4. 4. A sensor can publish to the door lock's command topic. Which principle is violated?

    Each device should have only the permissions its job requires.

Summary

  • Threat modeling: list assets, draw trust boundaries, map the attack surface, apply STRIDE to each interface.
  • IoT adds physical access, long lifetimes, weak update paths and a real-world impact.
  • Most failures are basic: default credentials, hard-coded secrets, missing encryption, no updates.
  • Audit configurations automatically and throttle guessing, but build strong identity and least privilege in from the start.

Next: Device Identity, TLS and Access Control

Theo dõi tiến độ của bạn

Tạo tài khoản miễn phí để đánh dấu bài đã học và tiếp tục từ chỗ bạn dừng lại trên mọi thiết bị.