Ravindra BagaleCourses & study guides

43. IoT and OT Security – Cameras, Smart Devices, Plant Networks

43.9 Lab – Mosquitto MQTT or Fake Camera UI on OWN VM

Pick Path A (MQTT – preferred) or Path B (tiny HTTP "camera" page). Host-only only.

Path A – Mosquitto on Amazon Linux / Ubuntu (192.168.56.50 or .40):

# Amazon Linux
sudo yum install mosquitto mosquitto-clients
# Ubuntu:
# sudo apt update && sudo apt install -y mosquitto mosquitto-clients
sudo service mosquitto start
sudo service mosquitto status
# Weak start (lab only – then FIX in project): anonymous open on all interfaces
# Edit /etc/mosquitto/mosquitto.conf (paths vary) toward:
#   listener 1883 0.0.0.0
#   allow_anonymous true
sudo service mosquitto restart
# From same VM or Kali – OWN lab only:
mosquitto_sub -h 192.168.56.50 -t 'sahyadri/warehouse/#' -v
# Other terminal:
mosquitto_pub -h 192.168.56.50 -t 'sahyadri/warehouse/door' -m 'open'

Path B – tiny "camera" web UI (Python http.server or Nginx static page) with a login form that accepts anything at first (lab), then you fix to a real password check + firewalld source allow from Kali only. Keep it on host-only .50.

# Optional: firewalld on the IoT VM – start open, later tighten
sudo yum install firewalld
sudo systemctl enable firewalld
sudo service firewalld start
sudo firewall-cmd --list-all

From Kali 192.168.56.10 (OWN only): nmap -sS -T2 -p 1883,80,22 192.168.56.50 – document open ports. Do not aim at anything outside 192.168.56.0/24.

Red team (attacker) does Blue team (defender) detects / stops
Anonymous MQTT pub to sahyadri/# After fix: auth required; ACL; log shows denied
Nmap finds 1883/80 on IoT VM Expected in weak phase; after fix only needed ports
Uses Metasploitable .20 as side practice Still host-only; don't bridge IoT to internet

Ravindra Bagale's Tip

Students systemctl start copypaste – notes madhe sudo service mosquitto start, enable only for boot. Weak config snapshot theva before fix. Interview walk: weak → prove → harden → prove. He lakshat theva.

Lab

Pair: Salman installs Path A on .50; Ravina runs mosquitto_pub / sub from Kali. Screenshot anonymous success. Ethics line signed (host-only). Then jump to project box to harden.