Python Unencrypted Telnet Connection
Description
Detects usage of unencrypted Telnet connections through Python's telnetlib module. Telnet protocol transmits data including credentials in plaintext, making it vulnerable to network sniffing attacks and unauthorized access.
Detection Strategy
• Check if 'telnetlib' module is imported in the Python code
• Look for usage of 'telnetlib.Telnet' class or 'Telnet' after import
• Report vulnerability when Telnet connection creation is detected through these classes
Vulnerable code example
from telnetlib import Telnet
# VULNERABLE: Using Telnet which transmits credentials in cleartext
tn = Telnet("router.example.com", 23)
tn.write(b"admin\n")
tn.write(b"password\n")✅ Secure code example
import paramiko
# SAFE: Using SSH instead of Telnet for encrypted communication
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('router.example.com', username='admin', password='password')
# Execute commands over secure SSH channel ...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.