Security

IoT Security Scanner & Vulnerability Assessment Tool

Automated security scanner for IoT devices detecting vulnerabilities, insecure configurations, and exposed services with comprehensive reporting and remediation guidance

Completed
Python 3.11ScapyNmapFlaskSQLiteDockerLinux
IoT Security Scanner & Vulnerability Assessment Tool

Problem Statement

IoT devices (smart cameras, thermostats, sensors, routers) proliferate in networks but often have severe security vulnerabilities:

  • Default credentials never changed (admin/admin)
  • Unencrypted communication protocols (HTTP, Telnet)
  • Outdated firmware with known CVEs
  • Exposed management interfaces to internet
  • Lack of security updates from manufacturers

University IT security team manually tested 200+ IoT devices every quarter, taking 4 hours per device. No automated tool existed for comprehensive IoT-specific security assessment that combined:

  • Network scanning for exposed services
  • Credential brute-forcing for default passwords
  • Firmware version detection and CVE matching
  • SSL/TLS configuration analysis
  • UPnP/SSDP service discovery

Manual testing was:

  • Time-consuming (800+ hours per quarter)
  • Error-prone (human fatigue missing vulnerabilities)
  • Inconsistent (different testers, different methodologies)
  • Poorly documented (no standardized reporting)

Solution Approach

Built an automated IoT security scanner that performs comprehensive vulnerability assessments, integrates with CVE databases, and generates detailed remediation reports.

Core Capabilities:

1. Device Discovery:

  • Network scanning using ARP, ICMP, and mDNS
  • UPnP/SSDP service discovery for IoT devices
  • MAC address vendor identification
  • OS fingerprinting via Nmap integration
  • Active vs passive scanning modes

2. Vulnerability Detection:

  • Default credential testing (database of 500+ manufacturer defaults)
  • Exposed service detection (Telnet, FTP, HTTP, MQTT, CoAP)
  • SSL/TLS misconfiguration analysis
  • Firmware version extraction and CVE matching
  • Known exploit detection (Metasploit module integration)

3. Security Analysis:

  • Open port scanning and service enumeration
  • Weak cipher suite detection
  • Certificate validation (expiry, self-signed, weak algorithms)
  • HTTP security header analysis
  • Authentication mechanism testing

4. Reporting & Remediation:

  • Comprehensive PDF reports with risk scoring
  • CVSS-based vulnerability prioritization
  • Step-by-step remediation guidance
  • Compliance mapping (NIST, CIS, OWASP IoT Top 10)
  • Historical scan comparison and trend analysis

5. Automation & Integration:

  • Scheduled scanning (daily, weekly, monthly)
  • REST API for integration with SIEM/SOC tools
  • Webhook notifications for critical findings
  • CLI and web UI for different workflows

Technical Implementation

Architecture:

┌─────────────────────────────────────────────┐
│           Web UI (Flask + Jinja2)           │
├─────────────────────────────────────────────┤
│              REST API Layer                 │
├─────────────────────────────────────────────┤
│         Scanning Engine (Python)            │
│  ┌──────────┬──────────┬──────────────────┐ │
│  │ Network  │ Vuln     │ CVE Database    │ │
│  │ Scanner  │ Detector │ Integration     │ │
│  └──────────┴──────────┴──────────────────┘ │
├─────────────────────────────────────────────┤
│     Data Layer (SQLite/PostgreSQL)          │
└─────────────────────────────────────────────┘

Network Scanning Module:

# Custom network scanner using Scapy
def discover_devices(network_range: str, scan_mode: str = "passive") -> List[Device]:
    devices = []

    if scan_mode == "passive":
        # ARP sniffing for device discovery (stealthy)
        packets = sniff(filter="arp", timeout=60)
        for packet in packets:
            if packet.haslayer(ARP) and packet[ARP].op == 2:  # ARP reply
                devices.append(extract_device_info(packet))
    else:
        # Active ARP scanning (faster but detectable)
        ans, unans = arping(network_range)
        devices = [extract_device_info(pkt) for snd, pkt in ans]

    # UPnP/SSDP discovery for IoT devices
    upnp_devices = discover_upnp_devices()
    devices.extend(upnp_devices)

    return devices

Vulnerability Detection Engine:

def check_default_credentials(device: Device) -> List[Vulnerability]:
    vulnerabilities = []

    # Load manufacturer-specific default credentials
    default_creds = get_default_credentials(device.manufacturer)

    for cred in default_creds:
        # Attempt authentication via discovered services
        if device.has_http:
            if test_http_auth(device.ip, cred.username, cred.password):
                vulnerabilities.append(Vulnerability(
                    type="DEFAULT_CREDENTIALS",
                    severity="CRITICAL",
                    cvss_score=9.8,
                    description=f"Default credentials {cred.username}/{cred.password}",
                    remediation="Change default password immediately"
                ))

        if device.has_telnet:
            if test_telnet_auth(device.ip, cred.username, cred.password):
                vulnerabilities.append(Vulnerability(
                    type="DEFAULT_CREDENTIALS_TELNET",
                    severity="CRITICAL",
                    cvss_score=10.0,
                    description="Telnet with default credentials",
                    remediation="Disable Telnet, enable SSH with key auth"
                ))

    return vulnerabilities

CVE Database Integration:

def match_cves(device: Device) -> List[CVE]:
    # Extract firmware version from HTTP headers, SNMP, or UPnP
    firmware_version = extract_firmware_version(device)

    # Query CVE database (NVD API)
    cves = query_nvd_api(
        vendor=device.manufacturer,
        product=device.model,
        version=firmware_version
    )

    # Filter and score CVEs
    relevant_cves = []
    for cve in cves:
        if cve.cvss_score >= 7.0:  # High/Critical only
            relevant_cves.append(cve)

    return sorted(relevant_cves, key=lambda x: x.cvss_score, reverse=True)

Security Considerations:

Ethical Hacking Practices:

  • Only scan networks with explicit authorization
  • Rate limiting to avoid DoS on IoT devices
  • Passive scanning mode for stealthy reconnaissance
  • Automatic cleanup of test accounts created
  • Responsible disclosure process for new vulnerabilities

Tool Security:

  • Admin authentication required for web UI
  • API keys for REST API access
  • Scan data encrypted at rest
  • No credential storage in scan results
  • Audit logs for all scans performed

Performance Optimization:

  • Async network scanning (concurrent device testing)
  • CVE database caching to reduce API calls
  • Incremental scanning (only test changed devices)
  • Distributed scanning for large networks
  • Result deduplication and aggregation

Outcomes & Results

Security Impact:

  • 47 critical vulnerabilities detected in university network
  • 23 devices with default credentials (4 exposed to internet)
  • 15 devices with unpatched critical CVEs (CVSS 9.0+)
  • 9 devices with Telnet exposed on public IPs
  • 100% vulnerability remediation within 30 days of reporting

Operational Efficiency:

  • Scanning time: 4 hours → 15 minutes per device (94% reduction)
  • Quarterly assessment: 800 hours → 50 hours (93% reduction)
  • IT security team productivity increased 10x
  • Monthly scans instead of quarterly (4x more frequent)

Vulnerability Discoveries:

  • 3 zero-day vulnerabilities disclosed to manufacturers
  • 2 CVEs assigned (CVE-2024-XXXXX, CVE-2024-YYYYY)
  • Coordinated disclosure with 90-day embargo
  • Security patches released by all vendors

Educational Value:

  • Demonstrated in Cybersecurity course labs
  • Used by 50+ students for capstone projects
  • Featured in university security research showcase
  • Basis for 2 research papers on IoT security

Recognition:

  • Presented at university security conference
  • Featured in IT security newsletter
  • Received commendation from CISO
  • Open-sourced tool used by 100+ organizations

Learnings

Network Programming:

  • Scapy is powerful but low-level - learned to build custom protocols
  • Async I/O with asyncio essential for scanning 200+ devices concurrently
  • Socket programming for custom protocol implementations (CoAP, MQTT)
  • Learned network packet structure (Ethernet, IP, TCP/UDP, ARP)

Security Best Practices:

  • Responsible disclosure is critical - worked with manufacturers on patches
  • Rate limiting prevents accidentally DoS-ing IoT devices (many have weak CPUs)
  • False positives are worse than false negatives for security tools - tuned detection thresholds
  • CVE databases have stale data - need multiple sources for accuracy

Linux & System Administration:

  • Learned iptables for network traffic filtering
  • Cron for scheduled scanning automation
  • systemd for service management
  • Docker for portable deployment (different network environments)

Python Engineering:

  • Type hints (mypy) caught 30+ bugs before runtime
  • pytest fixtures for repeatable network tests (mocked responses)
  • Multiprocessing for CPU-bound scanning tasks
  • Context managers for proper resource cleanup (socket connections)

Ethical Hacking:

  • Always get written authorization before scanning
  • Document everything for legal protection
  • Understand legal boundaries (CFAA in US, Computer Misuse Act in UK)
  • Penetration testing is different from real attacks - be responsible

Performance Optimization:

  • Initial scan took 2 hours for 200 devices - async brought it to 15 minutes
  • CVE API rate limits required aggressive caching strategy
  • Database indexing on device IP dramatically improved query speed
  • Profiling revealed network I/O was bottleneck, not computation

Future Enhancements

Advanced Detection Capabilities:

  • Machine learning for anomaly detection (unusual network traffic patterns)
  • Firmware analysis and binary reverse engineering
  • IoT malware detection (Mirai, Hajime, BrickerBot signatures)
  • Wi-Fi security testing (WPA/WPA2 vulnerabilities)
  • Bluetooth Low Energy (BLE) device scanning

Enterprise Features:

  • Multi-tenant support for MSPs
  • RBAC (role-based access control) for large teams
  • Integration with Splunk, ELK, SIEM platforms
  • Compliance reporting (GDPR, HIPAA, PCI-DSS)
  • Asset management and inventory tracking

Exploit Framework Integration:

  • Automated exploit verification (with user consent)
  • Metasploit module integration
  • Custom exploit development for common IoT vulnerabilities
  • Safe exploit sandboxing for testing

Reporting Enhancements:

  • Executive summary dashboards
  • Trend analysis over time (vulnerability growth/reduction)
  • Risk scoring based on business impact
  • Remediation tracking and ticketing integration
  • Automated patch deployment suggestions

Cloud Deployment:

  • SaaS version for remote scanning (via agent)
  • Distributed scanning architecture
  • Real-time monitoring and alerting
  • Integration with cloud security tools (AWS Inspector, Azure Security Center)