Clear-text protocols as ftp, telnet or non secure http are lacking encryption of transported data. They are also missing the capability to build an authenticated connection. This mean that any attacker who can sniff traffic from the network can read, modify or corrupt the transported content. These protocol are not secure as they expose applications to a large range of risk:

Note also that using the http protocol is being deprecated by major web browser.

In the past, it has led to the following vulnerabilities:

Ask Yourself Whether

There is a risk if you answered yes to any of those questions.

Recommended Secure Coding Practices

It is recommended to secure all transport channels (event local network) as it can take a single non secure connection to compromise an entire application or system.

Sensitive Code Example

These clients from Apache commons net libraries are based on unencrypted protocols and are not recommended:

val telnet = TelnetClient(); // Sensitive

val ftpClient = FTPClient(); // Sensitive

val smtpClient = SMTPClient(); // Sensitive

Unencrypted HTTP connections, when using okhttp library for instance, should be avoided:

val spec: ConnectionSpec = ConnectionSpec.Builder(ConnectionSpec.CLEARTEXT) // Sensitive
  .build()

Compliant Solution

Use instead these clients from Apache commons net and JSch/ssh library:

JSch jsch = JSch(); // Compliant

if(implicit) {
  // implicit mode is considered deprecated but offer the same security than explicit mode
  val ftpsClient = FTPSClient(true); // Compliant
}
else {
  val ftpsClient = FTPSClient(); // Compliant
}

if(implicit) {
  // implicit mode is considered deprecated but offer the same security than explicit mode
  val smtpsClient = SMTPSClient(true); // Compliant
}
else {
  val smtpsClient = SMTPSClient(); // Compliant
  smtpsClient.connect("127.0.0.1", 25);
  if (smtpsClient.execTLS()) {
    // commands
  }
}

Perform HTTP encrypted connections, with okhttp library for instance:

val spec: ConnectionSpec =ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) // Compliant
  .build()

Exceptions

No issue is reported for the following cases because they are not considered sensitive:

See