" SSH - ProtoBas

SSH (Secure Shell)

Port: 22
Type: Secure Remote Access

Description

SSH is a cryptographic network protocol used to securely access remote systems over an unsecured network. It provides encrypted communication channels that protect data integrity and confidentiality during remote login file transfers command execution and port forwarding. SSH replaced older insecure methods like Telnet and rlogin by introducing strong encryption mechanisms and modern authentication methods. Today SSH is one of the most critical tools in system administration cloud infrastructure management and network security operations.

Technical Details

  • Operates over TCP and uses port 22 by default.
  • Supports multiple authentication types including passwords public keys certificates and hardware tokens.
  • Uses strong encryption algorithms such as AES ChaCha20 and 3DES depending on configuration.
  • Provides integrity protection through MAC algorithms like HMAC SHA1 and SHA2 variants.
  • Uses a three phase connection setup consisting of key exchange authentication and channel creation.

How To Work

SSH works by establishing a secure encrypted channel between a client and a server before any sensitive information is exchanged. The first stage is the TCP connection which is initiated on port 22. Once this basic connection is created both sides begin negotiating the parameters that will secure the entire session.

After the TCP connection is active the client and server exchange protocol versions. This ensures that both parties understand each other's supported features and prevents downgrade attacks where an attacker forces older less secure versions. Once the versions match the key exchange process begins.

During key exchange both the client and the server agree on algorithms for encryption integrity and compression. Methods like Diffie Hellman or Elliptic Curve Diffie Hellman generate session keys that are used for encrypting the communication. These keys are never reused which increases the security of the session.

The server then proves its identity by presenting a public host key. The client verifies this key using a local known hosts file to ensure it is talking to the correct server. If the server key has changed unexpectedly the client warns the user because this could indicate a man in the middle attack.

After the server identity is verified the authentication stage begins. SSH supports several authentication methods. The most common are passwords and public key authentication. In password authentication the client sends credentials through the encrypted tunnel. In public key authentication the client must prove ownership of a private key without actually sending it across the network.

Once authentication succeeds the client and server create multiple secure logical channels inside the encrypted connection. Each channel performs a separate function. Channels may be used for remote shell access file transfers through SCP or SFTP or even tunneling and port forwarding between different network services.

When the user requests an interactive shell the server launches a remote terminal session. All keystrokes commands outputs and terminal resizing events are sent through encrypted SSH packets. This ensures that no external observer can view or tamper with the commands being executed.

SSH also supports port forwarding which allows clients to securely tunnel traffic from one network location to another. Local forwarding sends local traffic through the SSH server to a remote service. Remote forwarding exposes a local service on the remote server. Dynamic forwarding creates a proxy similar to a SOCKS tunnel.

Throughout the session SSH maintains packet sequence numbers integrity checks and encryption updates. If any tampering or packet corruption is detected SSH immediately terminates the session. This prevents attackers from injecting malicious commands or altering incoming data.

When the session ends the client sends a close request and all active channels are gracefully shut down. The server clears temporary keys and removes any allocated resources. System logs record authentication attempts key exchange results and executed commands which allows administrators to audit activity and detect suspicious behavior.

Security Considerations

SSH is highly secure but requires proper configuration. Weak passwords can still lead to compromise since brute force attacks are common. Old key exchange or encryption algorithms may expose systems to downgrade attacks. Exposed SSH ports also attract automated bots attempting credential guessing. Using strong keys disabling password authentication and limiting access to trusted IP ranges greatly increases security.

Potential Abuse Cases

Attackers may abuse SSH by brute forcing passwords through automated scripts. If an attacker obtains private keys they can authenticate silently. Compromised SSH servers can be used for pivoting through internal networks. SSH tunneling can also be used to hide malicious traffic by routing it through encrypted channels.

Detection Strategies

Detection involves monitoring logs for repeated failed login attempts unusual command execution patterns and unexpected key additions. Intrusion detection systems can look for abnormal SSH traffic patterns. Monitoring outbound SSH connections helps detect tunneling abuse. File integrity monitoring can reveal tampered authorized keys.

Mitigation Techniques

Administrators can harden SSH by disabling password logins requiring public key authentication and rotating keys regularly. Restricting port 22 with firewalls and fail2ban prevents brute force attempts. Using modern cryptographic algorithms enhancing logging and implementing two factor authentication significantly reduces attack surfaces. Limiting user permissions and disabling unused SSH features further strengthens security.

References

"