『CVE』简析CVE-2023-48795:SSH协议前缀截断攻击(Terrapin攻击)
文章目录
OpenSSH 9.6更新公告
*ssh(1), sshd(8):
implement protocol extensions to thwart the so-called “Terrapin attack” discovered by Fabian B?umer, Marcus Brinkmann and J?rg Schwenk. This attack allows a MITM to effect a limited break of the integrity of the early encrypted SSH transport protocol by sending extra messages prior to the commencement of encryption, and deleting an equal number of consecutive messages immediately after encryption starts. A peer SSH client/server would not be able to detect that messages were deleted.
实施协议扩展以挫败 Fabian B?umer、Marcus Brinkmann 和 J?rg Schwenk 发现的所谓 “Terrapin 攻击”。这种攻击允许中间人(adversary-in-the-middle, MITM) 在加密开始前发送额外信息,并在加密开始后立即删除相同数量的连续信息,从而有限度地破坏早期加密 SSH 传输协议的完整性。对等 SSH 客户端/服务器将无法检测到信息已被删除。
While cryptographically novel, the security impact of this attack is fortunately very limited as it only allows deletion of consecutive messages, and deleting most messages at this stage of the protocol prevents user user authentication from proceeding and results in a stuck connection.
虽然在密码学上很新颖,但幸运的是,这种攻击对安全的影响非常有限,因为它只允许删除连续的报文,而在协议的这一阶段删除大部分报文会阻止用户验证的进行,并导致连接卡死。
The most serious identified impact is that it lets a MITM to delete the SSH2_MSG_EXT_INFO message sent before authentication starts, allowing the attacker to disable a subset of the keystroke timing obfuscation features introduced in OpenSSH 9.5. There is no other discernable impact to session secrecy or session integrity.
已发现的最严重影响是,它使 MITM 能够删除在身份验证开始前发送的 SSH2_MSG_EXT_INFO 消息,使攻击者能够禁用 OpenSSH 9.5 中引入的按键定时混淆功能的一个子集。对会话保密性或会话完整性没有其他明显影响。
OpenSSH 9.6 addresses this protocol weakness through a new “strict KEX” protocol extension that will be automatically enabled when both the client and server support it. This extension makes two changes to the SSH transport protocol to improve the integrity of the initial key exchange.
OpenSSH 9.6 通过新的 **"严格 KEX "**协议扩展解决了这一协议弱点,当客户端和服务器都支持该扩展时,它将自动启用。该扩展对 SSH 传输协议做了两处修改,以提高初始密钥交换的完整性。
Firstly, it requires endpoints to terminate the connection if any unnecessary or unexpected message is received during key exchange (including messages that were previously legal but not strictly required like SSH2_MSG_DEBUG). This removes most malleability from the early protocol.
首先,它要求端点在密钥交换过程中收到任何不必要或意外信息(包括 SSH2_MSG_DEBUG 等以前合法但并非严格要求的信息)时终止连接。这就消除了早期协议的大部分可变性。
Secondly, it resets the Message Authentication Code counter at the conclusion of each key exchange, preventing previously inserted messages from being able to make persistent changes to the sequence number across completion of a key exchange. Either of these changes should be sufficient to thwart the Terrapin Attack.
其次,它在每次密钥交换结束时重置信息验证码计数器,防止先前插入的信息在密钥交换完成后对序列号进行持续更改。无论哪种变化,都足以挫败 Terrapin 攻击。
More details of these changes are in the PROTOCOL file in the OpenSSH source distribition.
有关这些更改的更多详情,请参阅 OpenSSH 源代码发行版中的 PROTOCOL 文件。
Terrapin攻击 (CVE-2023-48795)
基本信息
CVE-2023-48795: BaseScore N/A
CVSS:3.1/N/A
The SSH transport protocol with certain OpenSSH extensions, found in OpenSSH before 9.6 and other products, allows remote attackers to bypass integrity checks such that some packets are omitted (from the extension negotiation message), and a client and server may consequently end up with a connection for which some security features have been downgraded or disabled, aka a Terrapin attack. This occurs because the SSH Binary Packet Protocol (BPP), implemented by these extensions, mishandles the handshake phase and mishandles use of sequence numbers. For example, there is an effective attack against SSH’s use of ChaCha20-Poly1305 (and CBC with Encrypt-then-MAC). The bypass occurs in chacha20-poly1305@openssh.com and (if CBC is used) the -etm@openssh.com MAC algorithms.
在 9.6 之前的 OpenSSH 和其他产品中找到的具有某些 OpenSSH 扩展的 SSH 传输协议允许远程攻击者绕过完整性检查,从而省略某些数据包(来自扩展协商消息),因此客户端和服务器可能最终获得某些安全功能已降级或禁用的连接。 又名 Terrapin 攻击。这是因为这些扩展实现的 SSH 二进制数据包协议 (BPP) 错误地处理了握手阶段,并错误地处理了序列号的使用。例如,针对 SSH 使用 ChaCha20-Poly1305(以及带有 Encrypt-then-MAC 的 CBC)的攻击存在有效攻击。旁路发生在 chacha20-poly1305@openssh.com 和(如果使用 CBC)-etm@openssh.com MAC 算法中。
利用手段
中间人攻击、SSH握手、流量攻击
利用路径
在SSH双方建立安全通道前,有一次明文消息握手,中间人此时向SSH服务器发送X条报文,可以阻止Server在安全通道中发送给Client的前X条消息,可以干扰连接的设置,降低所使用的安全性
握手使用计数器计算收发包数,之后计数器用于验证握手过程是否完整。只要计数正确,允许继续连接。
利用条件
-
特定加密算法:ChaCha20-Poly1305和CBC with Encrypt-then-MAC
-
攻击者处于中间人位置,可以在 TCP/IP 层拦截和修改连接的流量
-
从本地网络发起,从Internet发起很困难
The Terrapin attack requires an active Man-in-the-Middle attacker, that means some way for an attacker to intercept and modify the data sent from the client or server to the remote peer. This is difficult on the Internet, but can be a plausible attacker model on the local network.
利用原理及示意图
攻击者可以在初始密钥交换期间注入任意数量的SSH消息,并在交换完成后移除相同数量的消息,从而破坏SSH扩展协商(RFC8308),可降级连接的安全性。
ChaCha20-Poly1305:
攻击者在握手结束前注入 IGNORE 信息,计数器的变化会在安全通道中阻断 EXT_INFO消息
CBC-EtM:
攻击者在Client发送 NEWKEYS 之前注入 UNKNOWN。 由于Server已经发送了 NEWKEYS,UNIMPLMENTED 消息将在 EXTINFO 之后在安全通道内发送。 损坏的未实现消息很可能被忽略
危害
该漏洞官方描述为:General Protocol Flaw(一般协议缺陷)
……通过中间人攻击,攻击者可能迫使SSH客户端采用较弱的身份验证方式,并停用一些防御机制,目前很难准确评估这个漏洞的真正影响……
……漏洞利用成本高,在真实场景中被利用几率很低,但影响面较大……
The data in the messages exchanged after the completion of the handshake determines the severity of the attack’s repercussions.
握手完成后交换的消息中的数据决定了攻击影响的严重性。Right now, the biggest mitigation factor for the attack is the MiTM requirement, which makes Terrapin a less severe threat. For this reason, patching CVE-2023-48795 may not be a priority in many cases.
目前,攻击的最大缓解因素是 MiTM 的需求,这使得 Terrapin 的威胁不那么严重。因此,在许多情况下,修补 CVE-2023-48795 可能不是优先事项。
基于Terrapin的潜在风险:CVE-2023-46445 & 46446
Python SSH客户端AsyncSSH的开源代码中存在可利用风险,目前Terrapin研究员上报了两个CVE
CVE-2023-46445: BaseScore 5.9
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
An issue in AsyncSSH before 2.14.1 allows attackers to control the extension info message (RFC 8308) via a man-in-the-middle attack, aka a “Rogue Extension Negotiation.”
低于 2.14.1 的 AsyncSSH 中存在一个问题,允许攻击者通过中间人攻击(也称为“恶意扩展协商”)来控制扩展信息消息 (RFC 8308)。
CVE-2023-46446: BaseScore 6.8
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
An issue in AsyncSSH before 2.14.1 allows attackers to control the remote end of an SSH client session via packet injection/removal and shell emulation, aka a “Rogue Session Attack.”
低于 2.14.1 的 AsyncSSH 中存在一个问题,允许攻击者通过数据包注入/删除和 shell 仿真来控制 SSH 客户端会话的远程端,也称为“恶意会话攻击”。
参考
oss-security - Announce: OpenSSH 9.6 released (openwall.com)
Terrapin attacks can downgrade security of OpenSSH connections
NVD - CVE-2023-48795 — NVD - CVE-2023-48795 (nist.gov)
NVD - CVE-2023-46445— NVD - CVE-2023-46445 (nist.gov)
NVD - CVE-2023-46446— NVD - CVE-2023-46446 (nist.gov)
完
欢迎关注我的博客 :CSDN@Ho1aAs
版权属于:Ho1aAs
本文链接:https://ho1aas.blog.csdn.net/article/details/135199758
版权声明:本文为原创,转载时须注明出处及本声明
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!