SSH, and replacing protocols that send in the clear

8 min 5 sections 4 practice questions 16 sources citedISC2 objective 4.1

Many of the internet's oldest protocols send everything, passwords included, as readable text. Each now has a secure replacement, and choosing it is one of the simplest controls a security manager can require. Secure Shell (SSH) replaced the old remote login tools and carries secure file transfer too. No background is assumed beyond the earlier network units. IPsec, TLS and SSH are the three secure protocols every network question draws on, and they are told apart by what each protects.

By the end of this unit you will be able to:

  • Explain why Telnet, FTP, HTTP, early SNMP and plain LDAP are unsafe on an untrusted network
  • Explain how SSH authenticates the server and the user, and why its host key must be checked
  • Name the secure replacement for each common clear-text protocol, telling apart SFTP, FTPS and SCP
  • Tell apart PAP, CHAP and EAP
  • Choose between IPsec, TLS and SSH for a given need

The contractor who read the caretaker's password

An illustrative example

A school's caretaker manages the heating controller from his office computer. He signs in to it remotely using an old tool that came with the controller.

A contractor plugs a laptop into a spare socket in the same corridor to test a new projector. Out of curiosity he runs a program that shows the traffic on the network. Within minutes the caretaker's user name and password for the heating controller scroll past his screen, in plain words.

What was it about the old tool that let a passer-by read the password, and what should replace it?

Older protocols send everything in readable form

Clear text is data sent as written, with no . Anyone who can capture the traffic can read it: a device on the same network, a compromised switch or router, or a rogue access point.

Telnet for remote login, the File Transfer Protocol (FTP) for files and HTTP for web pages all send their contents, user names and passwords in clear text. So did the Berkeley remote tools, rlogin, rsh and rcp.

The danger is not only reading. An attacker in the middle of a clear-text session can change what passes or take the session over, because nothing proves who sent each message.

The school's heating controller

The old tool was Telnet. Every keystroke, the password included, crossed the network in clear text, so the contractor's capture program could show it. SSH does the same job with everything encrypted.

SSH: an encrypted channel for remote login and file transfer

Secure Shell (SSH) gives an encrypted, authenticated channel for remote login, commands and file transfer. It listens on port 22 and has almost entirely replaced Telnet and the Berkeley tools. It is built in three parts.

Transport layer
Authenticates the server, agrees the keys and gives the channel and .
User authentication
Proves who the user is, by password or, more strongly, by key pair.
Connection layer
Carries several separate streams, called channels, inside the one encrypted connection.

Every SSH server has a host key, a key pair that identifies it. On the first connection the client is shown the key's fingerprint and asked to accept it, and it remembers the key after that. If an attacker sits in the middle on that first visit, the client may accept the attacker's key. A later warning that the host key has changed must be investigated, not clicked past.

In public-key authentication, the user's public key is placed on the server and the private key stays with the user. Signing in proves possession of the private key, so no password crosses the network or can be guessed. Those keys must be managed like any credential: listed, owned, rotated and removed when people leave.

Two further points matter. SSH version 1 had protocol weaknesses and must be disabled; version 2 is current. Port forwarding lets SSH carry other traffic inside its encrypted channel, which can hide that traffic from network security controls, so servers that do not need it should switch it off.

The secure replacement for each clear-text protocol

Clear-text protocols and their secure replacements
JobClear-text protocol and portSecure replacement and port
Remote loginTelnet, 23; rlogin, rshSSH, 22
File transferFTP, 20 and 21; TFTP, 69SFTP or SCP over SSH, 22; FTPS, FTP with TLS
WebHTTP, 80HTTPS, 443
Device managementSNMP versions 1 and 2c, 161 and 162SNMP version 3
Directory look-upsLDAP, 389LDAPS, 636
Mail transfer and collectionSMTP, 25; POP3, 110; IMAP, 143SMTP with TLS on 465, or on 25 and 587 by STARTTLS, a command that turns TLS on; POP3S, 995; IMAPS, 993
Email between peoplePlain emailS/MIME or OpenPGP

Three file transfer names are easy to confuse. SFTP, the SSH File Transfer Protocol, is a new protocol that runs inside SSH. SCP, secure copy, also runs over SSH and copies files from one machine to another. FTPS is the old FTP with TLS added, so it keeps FTP's separate command and data connections.

The Simple Network Management Protocol (SNMP) reads and changes settings on network devices. Versions 1 and 2c protect it only with a shared word called a community string and encrypt nothing. Version 3 adds proper user authentication, integrity and encryption.

S/MIME and OpenPGP protect an email message itself, not the link it travels over. Both give signatures for origin and integrity, and encryption for confidentiality. They differ in whom they trust. S/MIME uses certificates issued by a , an organisation trusted to vouch for who owns a key, the same kind TLS uses, and suits organisations. PGP, standardised as OpenPGP, uses a web of trust, in which users vouch for each other's keys.

Common misconception

“SFTP is FTP with security added.”

That is FTPS. SFTP is a separate protocol that runs inside SSH on port 22 and shares nothing with FTP but the purpose.

PAP, CHAP and EAP: proving identity over a link

When a device connects over a dial-up line or a tunnel, it has to prove who it is. Three protocols do this and are often compared.

Password Authentication Protocol (PAP)
Sends the user name and password in clear text, once. Anyone listening can capture and reuse them.
Challenge-Handshake Authentication Protocol (CHAP)
The server sends a random challenge, and the client answers with a of the challenge and the shared secret. The password never crosses the link, and the server repeats the challenge at random times.
MS-CHAP
Microsoft's versions of CHAP. Version 2 has serious known weaknesses.
Extensible Authentication Protocol (EAP)
A framework that carries many methods, such as , smart cards or one-time codes, chosen to suit the need.

CHAP's weakness is on the server: it needs the secret in readable form to compute the expected answer. EAP is the one to choose for new designs, and its methods are compared where wireless and network are taught.

IPsec, TLS and SSH side by side

The three secure protocols told apart
PointIPsecTLSSSH
Layer3, networkAbove TCP, usually placed at 4Application, over TCP
ProtectsEvery between two pointsOne program's conversationRemote login, commands and file transfer
Server proves itself byShared key or certificate, through IKECertificate from a trusted authorityHost key, remembered after first use
Typical useSite-to-site and remote access linksWebsites, email links, application callsAdministering servers and devices
PortsUDP 500 and 4500 for IKE; ESP is protocol 50TCP 443 for HTTPSTCP 22

Choose by what has to be protected. To protect everything between two offices, whatever program sends it, choose IPsec. To protect one program's conversation, such as a website, choose TLS. To administer a server or move files securely, choose SSH.

Two other protections belong to the same family. DNSSEC signs name look-up answers, and Kerberos protects sign-in by issuing tickets in place of sending passwords.

A question, worked through

A logistics firm's network team manages two hundred switches remotely using Telnet, and monitors them with SNMP version 2c. An internal audit flags both as clear-text risks. The network manager has approval to change both, and wants the switches still managed and monitored as now.

Which change BEST addresses the audit finding?

  1. Move management to SSH and monitoring to SNMP version 3
  2. Put Telnet and SNMP 2c on a separate management network
  3. Carry Telnet and SNMP 2c inside IPsec tunnels to the switches
  4. Move management to SSH and keep SNMP 2c on a management network
Decide on your answer, then open the reasoning
  1. The finding is that both protocols send credentials and data in clear text. The requirement is to keep remote management and monitoring.
  2. Rule out b: a separate network limits who can listen, but anyone on it can still capture the passwords and community strings in clear text.
  3. Rule out d: it fixes management, but SNMP 2c still sends its community string in clear text on that network, so half the finding remains.
  4. Between a and c: both protect the traffic on the way. But c keeps the clear-text protocols and adds two hundred tunnels, each with keys to manage, while a removes the cause with less to run.
  5. SSH is the standard replacement for Telnet, and SNMP version 3 adds authentication and encryption to monitoring. The answer is a.

Answer: A. Move management to SSH and monitoring to SNMP version 3

Choosing between good answers

A question describes credentials captured from network traffic
look for the clear-text protocol and choose its secure replacement, not a stronger password.
A question asks for file transfer over SSH
the answer is SFTP or SCP. FTPS is FTP over TLS.
SNMP must be kept and secured
choose SNMP version 3. Versions 1 and 2c send a community string and encrypt nothing.
SSH warns that a server's host key has changed
treat it as a possible man in the middle and confirm the key before connecting.
A question asks which link authentication protocol sends the password in clear text
the answer is PAP. CHAP sends a hashed response to a challenge.

Try it

Read the scan of one server, pick out each port that offers a clear-text service, and name the secure replacement.

Loading the preview.

Check your understanding

4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 4

A partner will accept nightly file deliveries over SSH on TCP port 22 and no other way. The finance team's current tool uses FTP.

Which protocol should replace FTP for these deliveries?

What to remember

  • Telnet, FTP, TFTP, HTTP, SNMP versions 1 and 2c and plain LDAP send their contents in clear text; replace them with SSH, SFTP or FTPS, HTTPS, SNMP version 3 and LDAPS.
  • Mail moves to SMTP with TLS on 465 or STARTTLS on 587, POP3S on 995 and IMAPS on 993. S/MIME trusts certificate authorities; PGP trusts a web of trust.
  • SSH on TCP 22 has three parts: transport, user authentication and connection. Its host key must be checked on first use, and public-key sign-in is stronger than a password.
  • SFTP and SCP run inside SSH; FTPS is FTP with TLS.
  • PAP sends the password in clear text, CHAP answers a challenge with a hash, and EAP is a framework for many methods.
  • IPsec protects every packet between two points at layer 3, TLS protects one program's conversation, and SSH protects remote administration and file transfer.

Say it from memory

  1. Compare IPsec, SSH and SSL/TLS: what each protects, where it sits, and its port or protocol number.

    IPsec protects every packet between two points at layer 3, with AH (protocol 51) or ESP (protocol 50) and IKE on UDP 500 and 4500. TLS protects one program's conversation above TCP, as in HTTPS on 443; every SSL version is retired. SSH protects remote login, commands and file transfer on TCP 22.

    Read this part again

  2. Which older protocols send their contents and passwords in clear text, and what can an attacker in the middle do besides read them?

    Telnet, FTP and HTTP send contents, user names and passwords in clear text, as did the Berkeley tools rlogin, rsh and rcp. An attacker in the middle of a clear-text session can also change what passes or take the session over, because nothing proves who sent each message.

    Read this part again

  3. What are the three parts of SSH, and what should a client do when warned that a host key has changed?

    The transport layer authenticates the server and agrees the keys. User authentication proves who the user is, by password or by key pair. The connection layer carries several channels inside one encrypted connection. A warning that the host key has changed must be investigated, not clicked past.

    Read this part again

  4. How do SFTP, SCP and FTPS differ, and what does SNMP version 3 add over versions 1 and 2c?

    SFTP is a separate protocol that runs inside SSH on port 22. SCP also runs over SSH and copies files between machines. FTPS is the old FTP with TLS added. SNMP versions 1 and 2c rely on a community string and encrypt nothing; version 3 adds user authentication, integrity and encryption.

    Read this part again

  5. How do PAP, CHAP and EAP prove identity over a link?

    PAP sends the user name and password in clear text, once. CHAP sends a random challenge, and the client answers with a hash of the challenge and the shared secret, so the password never crosses the link; the server needs the secret in readable form. EAP is a framework carrying many methods, such as certificates, smart cards or one-time codes.

    Read this part again

Sources