<section title="17.5. Secure Shell"><subsection title="Objective"><paragraph
    title="17.5.1."


><![CDATA[<p>Secure Shell (SSH) is implemented correctly as an Approved Cryptographic Protocol.</p>]]></paragraph>
 </subsection>
<subsection title="Context"> <block title="Scope"><paragraph
    title="17.5.2."


><![CDATA[<p>SSH is software based on the Secure Shell protocol and enables a connection to a remote system.</p>]]></paragraph>
<paragraph
    title="17.5.3."


><![CDATA[<p>This section covers information on the conditions under which commercial and open-source implementations of SSH can be used as an approved cryptographic protocol.  Additionally, secure copy and Secure File Transfer Protocol use SSH and are therefore also covered by this section.</p>]]></paragraph>
<paragraph
    title="17.5.4."


><![CDATA[<p>When using a product that implements SSH, requirements for using approved cryptographic protocols will also need to be referenced from the <a href="http://nzism.gcsb.govt.nz/ism-document#Section-15924">Section 17. 3 - Approved Cryptographic Protocols</a>.</p>]]></paragraph>
</block>
</subsection>
<subsection title="References"><paragraph
    title="17.5.5."


><![CDATA[<p>Further references can be found at:</p><table class="table-main">
<tbody>
<tr>
<td><strong>Reference</strong></td>
<td><strong>Title</strong></td>
<td><strong>Publisher</strong></td>
<td><strong>Source</strong></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<p><strong>Further information on SSH can be found in the SSH specification</strong></p>
</td>
<td style="text-align: center;">IETF</td>
<td>
<p><a rel="noopener noreferrer" href="https://www.rfc-editor.org/rfc/rfc4252" target="_blank">https://www.rfc-editor.org/rfc/rfc4252</a></p>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<p><strong>Further information on Open SSH</strong></p>
</td>
<td style="text-align: center;">
<p>Open SSH</p>
</td>
<td>
<p><a rel="noopener noreferrer" href="https://www.openssh.com/" target="_blank">https://www.openssh.com/</a></p>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<p><strong>OpenSSH 7.3</strong></p>
</td>
<td style="text-align: center;">
<p>Open SSH</p>
</td>
<td>
<p><a rel="noopener noreferrer" href="http://www.openssh.com/txt/release-7.3" target="_blank">http://www.openssh.com/txt/release-7.3</a></p>
</td>
</tr>
</tbody>
</table>]]></paragraph>
 </subsection>
<subsection title="Rationale &amp; Controls"> <block title="Using SSH"><paragraph
    title="17.5.6.R.01."

    tags="Cryptography,Technical"


><![CDATA[<p>The configuration directives provided are based on the OpenSSH implementation of SSH.  Agencies implementing SSH will need to adapt these settings to suit other SSH implementations.</p>]]></paragraph>
<paragraph
    title="17.5.6.R.02."

    tags="Cryptography,Technical"


><![CDATA[<p>SSH version 1 is known to have vulnerabilities.  In particular, it is susceptible to an adversary-in-the-middle attack, where an attacker who can intercept the protocol in each direction can make each node believe they are talking to the other.  SSH version 2 does not have this vulnerability.</p>]]></paragraph>
<paragraph
    title="17.5.6.R.03."

    tags="Cryptography,Technical"


><![CDATA[<p>SSH has the ability to forward connections and access privileges in a variety of ways.  This means that an attacker who can exploit any of these features can gain unauthorised access to a potentially large amount of classified information.</p>]]></paragraph>
<paragraph
    title="17.5.6.R.04."

    tags="Cryptography,Technical"


><![CDATA[<p>Host-based authentication requires no credentials (password, public key etc.) to authenticate although in some cases a host key can be used.  This renders SSH vulnerable to an IP spoofing attack.</p>]]></paragraph>
<paragraph
    title="17.5.6.R.05."

    tags="Cryptography,Technical"


><![CDATA[<p>An attacker who gains access to a system with system administrator privileges will have the ability to not only access classified information but to control that system completely.  Given the clearly more serious consequences of this, system administrator login or administrator privilege escalation SHOULD NOT be permitted.</p>]]></paragraph>
<paragraph
    title="17.5.6.C.01."

    tags="Cryptography,Technical"


    classification="All Classifications"
    compliance="Should"
    cid="2647"
><![CDATA[<p>The table below outlines the settings that SHOULD be implemented when using SSH.</p><table class="table-main" style="height: 288px;">
<tbody>
<tr>
<td style="width: 50%;">
<p>Configuration description</p>
</td>
<td>
<p>Configuration directive</p>
</td>
</tr>
<tr>
<td style="width: 50%;">
<p>Disallow the use of SSH version 1</p>
</td>
<td>
<p>Protocol 2</p>
</td>
</tr>
<tr>
<td style="width: 50%;">
<p>On machines with multiple interfaces, configure the SSH daemon to listen only on the required interfaces</p>
</td>
<td>ListenAddress <br>xxx.xxx.xxx.xxx</td>
</tr>
<tr>
<td style="width: 50%;">
<p>Disable connection forwarding</p>
</td>
<td>
<p>AllowTCPForwarding no</p>
</td>
</tr>
<tr>
<td style="width: 50%;">
<p>Disable gateway ports</p>
</td>
<td>
<p>Gatewayports no</p>
</td>
</tr>
<tr>
<td style="width: 50%;">
<p>Disable the ability to login directly as root</p>
</td>
<td>
<p>PermitRootLogin no</p>
</td>
</tr>
<tr>
<td style="width: 50%;">
<p>Disable host-based authentication</p>
</td>
<td>
<p>HostbasedAuthentication no</p>
</td>
</tr>
<tr>
<td style="width: 50%;">
<p>Disable rhosts-based authentication</p>
</td>
<td>
<p>RhostsAuthentication no<br>IgnoreRhosts yes</p>
</td>
</tr>
<tr>
<td style="width: 50%;">
<p>Do not allow empty passwords</p>
</td>
<td>PermitEmptyPasswords no</td>
</tr>
<tr>
<td style="width: 50%;">Configure a suitable login banner</td>
<td>Banner/directory/filename</td>
</tr>
<tr>
<td style="width: 50%;">Configure a login authentication timeout of no more than 60 seconds</td>
<td>LoginGraceTime xx</td>
</tr>
<tr>
<td style="width: 50%;">Disable X forwarding </td>
<td>X11Forwarding no</td>
</tr>
</tbody>
</table>]]></paragraph>
</block>
<block title="Authentication mechanisms"><paragraph
    title="17.5.7.R.01."

    tags="Cryptography,Technical"


><![CDATA[<p>Public key-based systems have greater potential for strong authentication, put simply, people are not able to remember particularly strong passwords.  Password-based authentication schemes are also more susceptible to interception than public key-based authentication schemes.</p>]]></paragraph>
<paragraph
    title="17.5.7.R.02."

    tags="Cryptography,Technical"


><![CDATA[<p>Passwords are more susceptible to guessing attacks, so if passwords are used in a system then countermeasures should be put into place to reduce the chance of a successful brute force attack.</p>]]></paragraph>
<paragraph
    title="17.5.7.C.01."

    tags="Cryptography,Technical"


    classification="All Classifications"
    compliance="Should"
    cid="2672"
><![CDATA[<p>Agencies SHOULD use public key-based authentication before using password-based authentication.</p>]]></paragraph>
<paragraph
    title="17.5.7.C.02."

    tags="Cryptography,Technical"


    classification="All Classifications"
    compliance="Should"
    cid="2673"
><![CDATA[<p>Agencies that allow password authentication SHOULD use techniques to block brute force attacks against the password.</p>]]></paragraph>
</block>
<block title="Automated remote access"><paragraph
    title="17.5.8.R.01."

    tags="Cryptography,Technical"


><![CDATA[<p>If password-less authentication is enabled, allowing access from unknown IP addresses would allow untrusted parties to automatically authenticate to systems without needing to know the password.</p>]]></paragraph>
<paragraph
    title="17.5.8.R.02."

    tags="Cryptography,Technical"


><![CDATA[<p>If port forwarding is not disabled or it is not configured securely, an attacker may be able to gain access to forwarded ports and thereby create a communication channel between the attacker and the host.</p>]]></paragraph>
<paragraph
    title="17.5.8.R.03."

    tags="Cryptography,Technical"


><![CDATA[<p>If agent credential forwarding is enabled, an intruder could connect to the stored authentication credentials and then use them to connect to other trusted hosts or even intranet hosts, if port forwarding has been allowed as well.</p>]]></paragraph>
<paragraph
    title="17.5.8.R.04."

    tags="Cryptography,Technical"


><![CDATA[<p>X11 is a computer software system and network protocol that provides a graphical user interface for networked computers.  Failing to disable X11 display remoting could result in an attacker being able to gain control of the computer displays as well as keyboard and mouse control functions.</p>]]></paragraph>
<paragraph
    title="17.5.8.R.05."

    tags="Cryptography,Technical"


><![CDATA[<p>Allowing console access permits every user who logs into the console to run programs that are normally restricted to the root user.</p>]]></paragraph>
<paragraph
    title="17.5.8.C.01."

    tags="Cryptography,Technical"


    classification="All Classifications"
    compliance="Should"
    cid="2725"
><![CDATA[<p>Agencies SHOULD use parameter checking when using the ‘forced command’ option.</p>]]></paragraph>
<paragraph
    title="17.5.8.C.02."

    tags="Cryptography,Technical"


    classification="All Classifications"
    compliance="Should"
    cid="2726"
><![CDATA[<p>Agencies that use logins without a password for automated purposes SHOULD disable:</p><ul>
<li>access from IP addresses that do not need access;</li>
<li>port forwarding;</li>
<li>agent credential forwarding;</li>
<li>X11 display remoting; and</li>
<li>console access.</li>
</ul>]]></paragraph>
<paragraph
    title="17.5.8.C.03."

    tags="Cryptography,Technical"


    classification="All Classifications"
    compliance="Should"
    cid="2727"
><![CDATA[<p>Agencies that use remote access without the use of a password SHOULD use the ‘forced command’ option to specify what command is executed.</p>]]></paragraph>
</block>
<block title="SSH-agent"><paragraph
    title="17.5.9.R.01."

    tags="Cryptography,Technical"


><![CDATA[<p>SSH-agent or other similar key caching programs hold and manage private keys stored on workstations and respond to requests from remote systems to verify these keys.  When an SSH-agent launches, it will request the user’s password.  This password is used to unlock the user’s private key.  Subsequent access to remote systems is performed by the agent and does not require the user to re-enter their password.  Screenlocks and expiring key caches ensure that the user’s private key is not left unlocked for long periods of time.</p>]]></paragraph>
<paragraph
    title="17.5.9.R.02."

    tags="Cryptography,Technical"


><![CDATA[<p>Agent credential forwarding is required when multiple SSH connections are chained to allow each system in the chain to authenticate the user.</p>]]></paragraph>
<paragraph
    title="17.5.9.C.01."

    tags="Cryptography,Technical"


    classification="All Classifications"
    compliance="Should"
    cid="2737"
><![CDATA[<p>Agencies that use SSH-agent or other similar key caching programs SHOULD:</p><ul>
<li>only use the software on workstation and servers with screenlocks;</li>
<li>ensure that the key cache expires within four hours of inactivity; and</li>
<li>ensure that agent credential forwarding is used when multiple SSH traversal is needed.</li>
</ul>]]></paragraph>
</block>
<block title="SSH-Versions"><paragraph
    title="17.5.10.R.01."

    tags="Cryptography,Technical"


><![CDATA[<p>Older versions contain known vulnerabilities which are regularly addressed or corrected by newer versions.</p>]]></paragraph>
<paragraph
    title="17.5.10.C.01."

    tags="Cryptography,Technical"


    classification="All Classifications"
    compliance="Should"
    cid="2740"
><![CDATA[<p>Agencies SHOULD ensure that the latest implementation of SSH software is being used. Older versions contain known vulnerabilities.</p>]]></paragraph>
</block>
</subsection>
</section>
