Assessing Vulnerabilities in IoT Protocols: A Cross-Layer Approach