Re: SSH Terrapin Prefix Truncation Weakness (CVE-2023-48795) on Red Hat Enterprise Linux release 8.7 (Ootpa)

Kaushal Shriyan <[email protected]> Wed, 24 Jan 2024 07:41:38 +0530
Newsgroups gmane.linux.redhat.general
Message-ID <CAD7Ssm9Nu9mye8-usTEn=7vuDP1OJRtjqUohvyu-r3EUVXyVnA@mail.gmail.com>
--000000000000f431ed060fa795f5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 24, 2024 at 6:51=E2=80=AFAM Jacob M Cutright <[email protected]=
> wrote:

> A default RHEL 8/9 system is going to use the system-wide crypto
> policies per /etc/sysconfig/sshd. Below is just a summarized version of
> https://access.redhat.com/security/cve/cve-2023-48795
>
> We can add in a cryptop-policies sub policy by creating the following fil=
e:
>
> cat << EOF > /etc/crypto-policies/policies/modules/CVE-2023-48795.pmod
> cipher@SSH =3D -CHACHA20-POLY1305
> ssh_etm =3D 0
> EOF
>
> Append this crypto policy to your current system crypto policies:
> update-crypto-policies --set $(update-crypto-policies
> --show):CVE-2023-48795
>
>
> Verify the new policy has taken place:
> update-crypto-policies --show
>
> Restart the application as recommended by command output:
> systemctl restart sshd.service
>
> Thanks,
> Jacob
>
> On 1/23/2024 11:02 AM, Kaushal Shriyan wrote:
> > Hi,
> >
> > I have the SSH Terrapin Prefix Truncation Weakness on Red Hat Enterpris=
e
> > Linux release 8.7 (Ootpa). The details are as follows.
> >
> > # rpm -qa | grep openssh
> > openssh-8.0p1-16.el8.x86_64
> > openssh-askpass-8.0p1-16.el8.x86_64
> > openssh-server-8.0p1-16.el8.x86_64
> > openssh-clients-8.0p1-16.el8.x86_64
> >
> > # cat /etc/redhat-release
> > Red Hat Enterprise Linux release 8.7 (Ootpa)
> > #
> >
> > SSH Terrapin Prefix Truncation Weakness (CVE-2023-48795)
> >
> > Synopsis
> > The remote SSH server is vulnerable to a mitm prefix truncation attack.
> > Description
> > The remote SSH server is vulnerable to a man-in-the-middle prefix
> > truncation weakness known as Terrapin.
> > This can allow a remote, man-in-the-middle attacker to bypass integrity
> > checks and downgrade the
> > connection's security.
> > Note that this plugin only checks for remote SSH servers that support
> > either ChaCha20-Poly1305 or CBC
> > with Encrypt-then-MAC and do not support the strict key exchange
> > countermeasures. It does not check for
> > vulnerable software versions.
> > See Also
> > https://terrapin-attack.com/ <https://terrapin-attack.com/>
> >
> > Solution
> > Contact the vendor for an update with the strict key exchange
> > countermeasures or disable the affected
> > algorithms.
> > Risk Factor
> > Medium
> > CVSS v3.0 Base Score
> > 5.9 (CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N)
> > CVSS v3.0 Temporal Score
> > 5.3 (CVSS:3.0/E:P/RL:O/RC:C)
> > VPR Score
> > 6.9
> > CVSS v2.0 Base Score
> > 5.4 (CVSS2#AV:N/AC:H/Au:N/C:N/I:C/A:N)
> > CVSS v2.0 Temporal Score
> > 4.2 (CVSS2#E:POC/RL:OF/RC:C)
> > 187315 (10) - SSH Terrapin Prefix Truncation Weakness (CVE-2023-48795) =
16
> >
> > References
> > CVE CVE-2023-48795
> >
> > Is there a way to configure /etc/ssh/sshd_config to mitigate SSH
> > Terrapin Prefix Truncation Weakness (CVE-2023-48795)
> >
> > Please guide me.
> >
> > Thanks in advance.
> >
> > Best Regards,
> >
> > Kaushal
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "[email protected]" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [email protected]
> > <mailto:[email protected]>.
>

Thanks a lot Ben, Mike and Jacob for a quick and detailed response.
Much appreciated. I have used the below steps to mitigate SSH Terrapin
Prefix Truncation Weakness (CVE-2023-48795) for the benefit of the entire
community who will encounter a similar SSH vulnerability.

# rpm -qa | grep openssh
openssh-8.0p1-16.el8.x86_64
openssh-askpass-8.0p1-16.el8.x86_64
openssh-server-8.0p1-16.el8.x86_64
openssh-clients-8.0p1-16.el8.x86_64

# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.7 (Ootpa)
#

#cd /etc/crypto-policies/policies/modules/
#touch CVE-2023-48795.pmod
###content in CVE-2023-48795.pmod file as per below
#vim CVE-2023-48795.pmod
cipher@SSH =3D -CHACHA20-POLY1305
ssh_etm =3D 0
#update-crypto-policies --set $(update-crypto-policies
--show):CVE-2023-48795
#update-crypto-policies --show
#systemctl restart sshd.service
#systemctl status sshd.service

I have used https://github.com/RUB-NDS/Terrapin-Scanner. Terrapin
Vulnerability Scanner is a small utility program written in Go, which can
be used to determine the vulnerability of an SSH client or server against
the Terrapin Attack (https://terrapin-attack.com/)

#wget https://go.dev/dl/go1.21.6.linux-amd64.tar.gz
#tar -C /usr/local -xzf go1.21.6.linux-amd64.tar.gz
#export PATH=3D$PATH:/usr/local/go/bin
#go version
#go install github.com/RUB-NDS/Terrapin-Scanner@latest
#cd /root/go/bin/
# ./Terrapin-Scanner --connect localhost --json (Command to validate the
SSH Terrapin Prefix Truncation Weakness CVE-2023-48795 in JSON format)
{
    "RemoteAddr": "[::1]:22",
    "IsServer": true,
    "Banner": "SSH-2.0-OpenSSH_8.0",
    "SupportsChaCha20": false,
    "SupportsCbcEtm": false,
    "SupportsStrictKex": false,
    "Vulnerable": false
}
# ./Terrapin-Scanner --connect localhost (Command to validate the SSH
Terrapin Prefix Truncation Weakness CVE-2023-48795)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Report
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D

Remote Banner: SSH-2.0-OpenSSH_8.0

ChaCha20-Poly1305 support:   false
CBC-EtM support:             false

Strict key exchange support: false

The scanned peer supports Terrapin mitigations and can establish
connections that are NOT VULNERABLE to Terrapin. Glad to see this.
For strict key exchange to take effect, both peers must support it.

Note: This tool is provided as is, with no warranty whatsoever. It
determines
      the vulnerability of a peer by checking the supported algorithms and
      support for strict key exchange. It may falsely claim a peer to be
      vulnerable if the vendor supports countermeasures other than strict
key
      exchange.

For more details visit our website available at https://terrapin-attack.com
#

Thanks in advance.

Best Regards,

Kaushal

--=20
You received this message because you are subscribed to the Google Groups "=
[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].

--000000000000f431ed060fa795f5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Wed, Jan 24, 2024 at 6:51=E2=80=AF=
AM Jacob M Cutright &lt;<a href=3D"mailto:[email protected]">cutrightjm@stl=
.sh</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x">A default RHEL 8/9 system is going to use the system-wide crypto <br>
policies per /etc/sysconfig/sshd. Below is just a summarized version of <br=
>
<a href=3D"https://access.redhat.com/security/cve/cve-2023-48795" rel=3D"no=
referrer" target=3D"_blank">https://access.redhat.com/security/cve/cve-2023=
-48795</a><br>
<br>
We can add in a cryptop-policies sub policy by creating the following file:=
<br>
<br>
cat &lt;&lt; EOF &gt; /etc/crypto-policies/policies/modules/CVE-2023-48795.=
pmod<br>
cipher@SSH =3D -CHACHA20-POLY1305<br>
ssh_etm =3D 0<br>
EOF<br>
<br>
Append this crypto policy to your current system crypto policies:<br>
update-crypto-policies --set $(update-crypto-policies --show):CVE-2023-4879=
5<br>
<br>
<br>
Verify the new policy has taken place:<br>
update-crypto-policies --show<br>
<br>
Restart the application as recommended by command output:<br>
systemctl restart sshd.service<br>
<br>
Thanks,<br>
Jacob<br>
<br>
On 1/23/2024 11:02 AM, Kaushal Shriyan wrote:<br>
&gt; Hi,<br>
&gt; <br>
&gt; I have the SSH Terrapin Prefix Truncation Weakness on=C2=A0Red Hat Ent=
erprise <br>
&gt; Linux release 8.7 (Ootpa). The details are as follows.<br>
&gt; <br>
&gt; # rpm -qa | grep openssh<br>
&gt; openssh-8.0p1-16.el8.x86_64<br>
&gt; openssh-askpass-8.0p1-16.el8.x86_64<br>
&gt; openssh-server-8.0p1-16.el8.x86_64<br>
&gt; openssh-clients-8.0p1-16.el8.x86_64<br>
&gt; <br>
&gt; # cat /etc/redhat-release<br>
&gt; Red Hat Enterprise Linux release 8.7 (Ootpa)<br>
&gt; #<br>
&gt; <br>
&gt; SSH Terrapin Prefix Truncation Weakness (CVE-2023-48795)<br>
&gt; <br>
&gt; Synopsis<br>
&gt; The remote SSH server is vulnerable to a mitm prefix truncation attack=
.<br>
&gt; Description<br>
&gt; The remote SSH server is vulnerable to a man-in-the-middle prefix <br>
&gt; truncation weakness known as Terrapin.<br>
&gt; This can allow a remote, man-in-the-middle attacker to bypass integrit=
y <br>
&gt; checks and downgrade the<br>
&gt; connection&#39;s security.<br>
&gt; Note that this plugin only checks for remote SSH servers that support =
<br>
&gt; either ChaCha20-Poly1305 or CBC<br>
&gt; with Encrypt-then-MAC and do not support the strict key exchange <br>
&gt; countermeasures. It does not check for<br>
&gt; vulnerable software versions.<br>
&gt; See Also<br>
&gt; <a href=3D"https://terrapin-attack.com/" rel=3D"noreferrer" target=3D"=
_blank">https://terrapin-attack.com/</a> &lt;<a href=3D"https://terrapin-at=
tack.com/" rel=3D"noreferrer" target=3D"_blank">https://terrapin-attack.com=
/</a>&gt;<br>
&gt; <br>
&gt; Solution<br>
&gt; Contact the vendor for an update with the strict key exchange <br>
&gt; countermeasures or disable the affected<br>
&gt; algorithms.<br>
&gt; Risk Factor<br>
&gt; Medium<br>
&gt; CVSS v3.0 Base Score<br>
&gt; 5.9 (CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N)<br>
&gt; CVSS v3.0 Temporal Score<br>
&gt; 5.3 (CVSS:3.0/E:P/RL:O/RC:C)<br>
&gt; VPR Score<br>
&gt; 6.9<br>
&gt; CVSS v2.0 Base Score<br>
&gt; 5.4 (CVSS2#AV:N/AC:H/Au:N/C:N/I:C/A:N)<br>
&gt; CVSS v2.0 Temporal Score<br>
&gt; 4.2 (CVSS2#E:POC/RL:OF/RC:C)<br>
&gt; 187315 (10) - SSH Terrapin Prefix Truncation Weakness (CVE-2023-48795)=
 16<br>
&gt; <br>
&gt; References<br>
&gt; CVE CVE-2023-48795<br>
&gt; <br>
&gt; Is there a way to configure /etc/ssh/sshd_config to mitigate SSH <br>
&gt; Terrapin Prefix Truncation Weakness (CVE-2023-48795)<br>
&gt; <br>
&gt; Please guide me.<br>
&gt; <br>
&gt; Thanks in advance.<br>
&gt; <br>
&gt; Best Regards,<br>
&gt; <br>
&gt; Kaushal<br>
&gt; <br>
&gt; -- <br>
&gt; You received this message because you are subscribed to the Google <br=
>
&gt; Groups &quot;<a href=3D"mailto:[email protected]" target=3D"_blan=
k">[email protected]</a>&quot; group.<br>
&gt; To unsubscribe from this group and stop receiving emails from it, send=
 <br>
&gt; an email to <a href=3D"mailto:redhat-list%[email protected]" ta=
rget=3D"_blank">[email protected]</a> <br>
&gt; &lt;mailto:<a href=3D"mailto:redhat-list%[email protected]" tar=
get=3D"_blank">[email protected]</a>&gt;.<br></blockquote>=
<div><br></div><div>Thanks a lot Ben, Mike and Jacob for a quick and detail=
ed response. Much=C2=A0appreciated. I have used the below steps to mitigate=
 SSH Terrapin Prefix Truncation Weakness (CVE-2023-48795) for the benefit o=
f the entire community who will encounter a similar SSH vulnerability.=C2=
=A0</div><div><br></div><div><div># rpm -qa | grep openssh<br>openssh-8.0p1=
-16.el8.x86_64<br>openssh-askpass-8.0p1-16.el8.x86_64<br>openssh-server-8.0=
p1-16.el8.x86_64<br>openssh-clients-8.0p1-16.el8.x86_64<br><br></div><div>#=
 cat /etc/redhat-release<br>Red Hat Enterprise Linux release 8.7 (Ootpa)<br=
>#</div></div><div><br></div><div>#cd /etc/crypto-policies/policies/modules=
/<br>#touch CVE-2023-48795.pmod</div><div>###content in CVE-2023-48795.pmod=
 file as per below<br>#vim CVE-2023-48795.pmod<br>cipher@SSH =3D -CHACHA20-=
POLY1305<br>ssh_etm =3D 0<br>#update-crypto-policies --set $(update-crypto-=
policies --show):CVE-2023-48795</div><div>#update-crypto-policies --show<br=
></div><div>#systemctl restart sshd.service</div><div>#systemctl status ssh=
d.service</div><div><br></div><div>I have used <a href=3D"https://github.co=
m/RUB-NDS/Terrapin-Scanner">https://github.com/RUB-NDS/Terrapin-Scanner</a>=
. Terrapin Vulnerability Scanner is a small utility program written in Go, =
which can be used to determine the vulnerability of an SSH client or server=
 against the Terrapin Attack (<a href=3D"https://terrapin-attack.com/">http=
s://terrapin-attack.com/</a>)</div><div><br></div><div>#wget <a href=3D"htt=
ps://go.dev/dl/go1.21.6.linux-amd64.tar.gz">https://go.dev/dl/go1.21.6.linu=
x-amd64.tar.gz</a><br></div><div>#tar -C /usr/local -xzf go1.21.6.linux-amd=
64.tar.gz<br>#export PATH=3D$PATH:/usr/local/go/bin<br>#go version<br>#go i=
nstall <a href=3D"http://github.com/RUB-NDS/Terrapin-Scanner@latest">github=
.com/RUB-NDS/Terrapin-Scanner@latest</a><br>#cd /root/go/bin/</div><div># .=
/Terrapin-Scanner --connect localhost --json (Command to validate the SSH T=
errapin Prefix Truncation Weakness CVE-2023-48795 in JSON format)<br>{<br>=
=C2=A0 =C2=A0 &quot;RemoteAddr&quot;: &quot;[::1]:22&quot;,<br>=C2=A0 =C2=
=A0 &quot;IsServer&quot;: true,<br>=C2=A0 =C2=A0 &quot;Banner&quot;: &quot;=
SSH-2.0-OpenSSH_8.0&quot;,<br>=C2=A0 =C2=A0 &quot;SupportsChaCha20&quot;: f=
alse,<br>=C2=A0 =C2=A0 &quot;SupportsCbcEtm&quot;: false,<br>=C2=A0 =C2=A0 =
&quot;SupportsStrictKex&quot;: false,<br>=C2=A0 =C2=A0 &quot;Vulnerable&quo=
t;: false<br>}<br># ./Terrapin-Scanner --connect localhost (Command to vali=
date the SSH Terrapin Prefix Truncation Weakness CVE-2023-48795)<br>=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D<br>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Report =3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D<br>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br><br>Remote Banner: SSH-2.0-OpenSSH_=
8.0<br><br>ChaCha20-Poly1305 support: =C2=A0 false<br>CBC-EtM support: =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 false<br><br>Strict key exchange sup=
port: false<br><br>The scanned peer supports Terrapin mitigations and can e=
stablish<br>connections that are NOT VULNERABLE to Terrapin. Glad to see th=
is.<br>For strict key exchange to take effect, both peers must support it.<=
br><br>Note: This tool is provided as is, with no warranty whatsoever. It d=
etermines<br>=C2=A0 =C2=A0 =C2=A0 the vulnerability of a peer by checking t=
he supported algorithms and<br>=C2=A0 =C2=A0 =C2=A0 support for strict key =
exchange. It may falsely claim a peer to be<br>=C2=A0 =C2=A0 =C2=A0 vulnera=
ble if the vendor supports countermeasures other than strict key<br>=C2=A0 =
=C2=A0 =C2=A0 exchange.<br><br>For more details visit our website available=
 at <a href=3D"https://terrapin-attack.com">https://terrapin-attack.com</a>=
<br>#<br></div><div><br></div><div>Thanks in advance.=C2=A0</div><div><br><=
/div><div>Best Regards,</div><div><br></div><div>Kaushal</div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;[email protected]&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">redhat-list+u=
[email protected]</a>.<br />

--000000000000f431ed060fa795f5--