Attacks on 5G Infrastructure From Users’ Devices

渗透技巧 6个月前 admin
208 0 0

5G unlocks unprecedented applications previously unreachable with conventional wireless connectivity to help enterprises accelerate digital transformation, reduce operational costs, and maximize productivity for the best return on investments. To achieve its goals, 5G relies on key service categories: massive machine-type communications (mMTC), enhanced mobile broadband (eMBB), and ultra-reliable low-latency communication (uRLLC).
5G 解锁了以前传统无线连接无法实现的前所未有的应用,帮助企业加速数字化转型、降低运营成本并最大限度地提高生产力,从而获得最佳投资回报。为了实现其目标,5G 依赖于关键服务类别:大规模机器类通信 (mMTC)、增强型移动宽带 (eMBB) 和超可靠低延迟通信 (uRLLC)。

With the growing spectrum for commercial use, usage and popularization of private 5G networks are on the rise. The manufacturing, defense, ports, energy, logistics, and mining industries are just some of the earliest adopters of these private networks, especially for companies rapidly leaning on the internet of things (IoT) for digitizing production systems and supply chains. Unlike public grids, the cellular infrastructure equipment in private 5G might be owned and operated by the user-enterprise themselves, system integrators, or by carriers. However, given the growing study and exploration of the use of 5G for the development of various technologies, cybercriminals are also looking into exploiting the threats and risks that can be used to intrude into the systems and networks of both users and organizations via this new communication standard. This entry explores how normal user devices can be abused in relation to 5G’s network infrastructure and use cases.
随着商用频谱的增加,5G专网的使用和普及率正在上升。制造业、国防、港口、能源、物流和采矿业只是这些专用网络的最早采用者之一,特别是对于迅速依靠物联网 (IoT) 实现生产系统和供应链数字化的公司而言。与公共电网不同,私有5G中的蜂窝基础设施设备可能由用户企业本身、系统集成商或运营商拥有和运营。然而,鉴于对使用5G开发各种技术的研究和探索不断增加,网络犯罪分子也在研究利用威胁和风险,这些威胁和风险可用于通过这种新的通信标准侵入用户和组织的系统和网络。本条目探讨了与5G网络基础设施和用例相关的普通用户设备如何被滥用。

5G topology 5G 拓扑

In an end-to-end 5G cellular system, user equipment (aka UE, such as mobile phones and internet-of-things [IoT] devices), connect to a base station via radio waves. The base station is connected to the 5G core through a wired IP network.
在端到端 5G 蜂窝系统中,用户设备(也称为 UE,例如移动电话和物联网 [IoT] 设备)通过无线电波连接到基站。基站通过有线IP网络连接到5G核心。

Functionally, the 5G core can be split into two: the control plane and the user plane. In the network, the control plane carries the signals and facilitates the traffic based on how it is exchanged from one endpoint to another. Meanwhile, the user plane functions to connect and process the user data that comes over the radio area network (RAN).
从功能上讲,5G核心网可以分为两个:控制平面和用户平面。在网络中,控制平面承载信号,并根据流量从一个端点到另一个端点的交换方式来促进流量。同时,用户平面的功能是连接和处理来自无线电局域网(RAN)的用户数据。

The base station sends control signals related to device attachment and establishes the connection to the control plane via NGAP (Next-Generation Application Protocol). The user traffic from devices is sent to the user plane using GTP-U (GPRS tunneling protocol user plane). From the user plane, the data traffic is routed to the external network. 
基站发送与设备连接相关的控制信号,并通过NGAP(下一代应用协议)与控制平面建立连接。来自设备的用户流量使用 GTP-U(GPRS 隧道协议用户平面)发送到用户平面。从用户平面,数据流量被路由到外部网络。

Attacks on 5G Infrastructure From Users’ Devices

Figure 1. The basic 5G network infrastructure 图 1.基本的 5G 网络基础设施

The UE subnet and infrastructure network are separate and isolated from each other; user equipment is not allowed to access infrastructure components. This isolation helps protect the 5G core from CT (Cellular Technology) protocol attacks generated from users’ equipment.
UE 子网和基础设施网络是分开的,彼此隔离;不允许用户设备访问基础设施组件。这种隔离有助于保护 5G 核心免受用户设备产生的 CT(蜂窝技术)协议攻击。

Is there a way to get past this isolation and attack the 5G core? The next sections elaborate on the how cybercriminals could abuse components of the 5G infrastructure, particularly the GTP-U.
有没有办法克服这种隔离并攻击5G核心?接下来的章节将详细阐述网络犯罪分子如何滥用5G基础设施的组件,特别是GTP-U。

GTP-U GTP-U型

GTP-U is a tunneling protocol that exists between the base station and 5G user plane using port 2152. The following is the structure of a user data packet encapsulated in GTP-U.
GTP-U 是基站和 5G 用户平面之间使用的隧道协议,使用端口 2152。以下是封装在GTP-U中的用户数据包的结构。

Attacks on 5G Infrastructure From Users’ Devices

Figure 2. GTP-U data packet 图2.GTP-U数据包

A GTP-U tunnel packet is created by attaching a header to the original data packet. The added header consists of a UDP (User Datagram Protocol) transport header plus a GTP-U specific header. The GTP-U header consists of the following fields:
GTP-U隧道数据包是通过将报头附加到原始数据包来创建的。添加的报头包括 UDP(用户数据报协议)传输报头和特定于 GTP-U 的报头。GTP-U 标头由以下字段组成:

  • Flags: This contains the version and other information (such as an indication of whether optional header fields are present, among others).
    标志:包含版本和其他信息(例如,是否存在可选标头字段的指示等)。
  • Message type: For GTP-U packet carrying user data, the message type is 0xFF.
    消息类型:对于携带用户数据的GTP-U报文,消息类型为0xFF。
  • Length: This is the length in bytes of everything that comes after the Tunnel Endpoint Identifier (TEID) field.
    长度:这是隧道终结点标识符 (TEID) 字段后面的所有内容的长度(以字节为单位)。
  • TEID: Unique value for a tunnel that maps the tunnel to user devices
    TEID:将隧道映射到用户设备的隧道的唯一值

The GTP-U header is added by the GTP-U nodes (the base station and User Plane Function or UPF). However, the user cannot see the header on the user interface of the device. Therefore, user devices cannot manipulate the header fields.
GTP-U 标头由 GTP-U 节点(基站和用户平面功能或 UPF)添加。但是,用户无法在设备的用户界面上看到标头。因此,用户设备无法操作标头字段。

Although GTP-U is a standard tunneling technique, its use is mostly restricted to CT environments between the base station and the UPF or between UPFs. Assuming the best scenario, the backhaul between the base station and the UPF is encrypted, protected by a firewall, and closed to outside access. Here is a breakdown of the ideal scenario: GSMA recommends IP security (IPsec) between the base station and the UPF. In such a scenario, packets going to the GTP-U nodes come from authorized devices only. If these devices follow specifications and implement them well, none of them will send anomalous packets. Besides, robust systems are expected to have strong sanity checks to handle received anomalies, especially obvious ones such as invalid lengths, types, and extensions, among others.
尽管GTP-U是一种标准的隧道技术,但其使用主要局限于基站和UPF之间或UPF之间的CT环境。假设最佳方案是,基站和 UPF 之间的回程是加密的,由防火墙保护,并且不对外界访问。以下是理想场景的细分:GSMA 建议在基站和 UPF 之间使用 IP 安全 (IPsec)。在这种情况下,发送到 GTP-U 节点的数据包仅来自授权设备。如果这些设备遵循规范并很好地实现它们,它们都不会发送异常数据包。此外,健壮的系统应该具有强大的健全性检查,以处理接收到的异常,尤其是明显的异常,例如无效的长度、类型和扩展等。

In reality, however, the scenario could often be different and would require a different analysis altogether. Operators are reluctant to deploy IPsec on the N3 interface because it is CPU-intensive and reduces the throughput of user traffic. Also, since the user data is perceived to be protected at the application layer (with additional protocols such as TLS or Transport Layer Security), some consider IP security redundant. One might think that for as long as the base station and packet-core conform to the specific, there will be no anomalies. Besides, one might also think that for all robust systems require sanity checks to catch any obvious anomalies. However, previous studies have shown that many N3 nodes (such as UPF) around the world, although they should not be, are exposed to the internet. This is shown in the following sections.
然而,在现实中,情况往往可能不同,需要完全不同的分析。运营商不愿意在 N3 接口上部署 IPsec,因为它占用了 CPU 大量资金,并且会降低用户流量的吞吐量。此外,由于用户数据被认为在应用层受到保护(使用TLS或传输层安全性等附加协议),因此有些人认为IP安全是多余的。有人可能会认为,只要基站和分组核心符合特定要求,就不会有异常。此外,人们可能还会认为,对于所有健壮的系统来说,都需要健全性检查来捕捉任何明显的异常。然而,先前的研究表明,世界上许多N3节点(如UPF)虽然不应该暴露在互联网上。这将在以下各节中显示。

Attacks on 5G Infrastructure From Users’ Devices

Figure 3. Exposed UPF interfaces due to misconfigurations or lack of firewalls; screenshot taken from Shodan and used in a previously published research

We discuss two concepts that can exploit the GTP-U using CVE-2021-45462. In Open5GS, a C-language open-source implementation for 5G Core and Evolved Packet Core (EPC), sending a zero-length, type=255 GTP-U packet from the user device resulted in a denial of service (DoS) of the UPF. This is CVE-2021-45462, a security gap in the packet core that can crash the UPF (in 5G) or Serving Gateway User Plane Function (SGW-U in 4G/LTE) via an anomalous GTP-U packet crafted from the UE and by sending this anomalous GTP-U packet in the GTP-U. Given that the exploit affects a critical component of the infrastructure and cannot be resolved as easily, the vulnerability has received a Medium to High severity rating.
我们讨论了可以使用 CVE-2021-45462 利用 GTP-U 的两个概念。在 Open5GS(一种针对 5G 核心网和演进分组核心 (EPC) 的 C 语言开源实现)中,从用户设备发送长度为零的 type=255 GTP-U 数据包会导致 UPF 拒绝服务 (DoS)。这是 CVE-2021-45462,这是数据包核心中的一个安全漏洞,它可以通过从 UE 构建的异常 GTP-U 数据包并在 GTP-U 中发送此异常 GTP-U 数据包,使 UPF(在 5G 中)或服务网关用户平面功能(在 4G/LTE 中为 SGW-U)崩溃。鉴于该漏洞影响基础设施的关键组件,并且无法轻松解决,因此该漏洞已获得中到高严重等级。

GTP-U nodes: Base station and UPF
GTP-U节点:基站和UPF

GTP-U nodes are endpoints that encapsulate and decapsulate GTP-U packets. The base station is the GTP-U node on the user device side. As the base station receives user data from the UE, it converts the data to IP packets and encapsulates it in the GTP-U tunnel.
GTP-U 节点是封装和解封装 GTP-U 数据包的端点。基站是用户设备侧的GTP-U节点。当基站从UE接收用户数据时,它会将数据转换为IP数据包,并将其封装在GTP-U隧道中。

The UPF is the GTP-U node on the 5G core (5GC) side. When it receives a GTP-U packet from the base station, the UPF decapsulates the outer GTP-U header and takes out the inner packet. The UPF looks up the destination IP address in a routing table (also maintained by the UPF) without checking the content of the inner packet, after which the packet is sent on its way.
UPF 是 5G 核心 (5GC) 侧的 GTP-U 节点。当UPF从基站接收到GTP-U数据包时,UPF会解封外部GTP-U报头并取出内部数据包。UPF 在路由表(也由 UPF 维护)中查找目标 IP 地址,而不检查内部数据包的内容,然后发送数据包。

GTP-U in GTP-U GTP-U中的GTP-U

What if a user device crafts an anomalous GTP-U packet and sends it to a packet core?
如果用户设备制作异常的 GTP-U 数据包并将其发送到数据包核心,该怎么办?

Attacks on 5G Infrastructure From Users’ Devices

Figure 4. A specially crafted anomalous GTP-U packet 图4.特制的异常 GTP-U 数据包
Attacks on 5G Infrastructure From Users’ Devices

Figure 5. Sending an anomalous GTP-U packet from the user device 图5.从用户设备发送异常的 GTP-U 数据包

As intended, the base station will tunnel this packet inside its GTP-U tunnel and send to the UPF. This results in a GTP-U in the GTP-U packet arriving at the UPF. There are now two GTP-U packets in the UPF: The outer GTP-U packet header is created by the base station to encapsulate the data packet from the user device. This outer GTP-U packet has 0xFF as its message type and a length of 44. This header is normal. The inner GTP-U header is crafted and sent by the user device as a data packet. Like the outer one, this inner GTP-U has 0xFF as message type, but a length of 0 is not normal.
按预期,基站将在其 GTP-U 隧道内将此数据包通过隧道传输并发送到 UPF。这会导致 GTP-U 数据包中的 GTP-U 到达 UPF。UPF 中现在有两个 GTP-U 数据包: 外部 GTP-U 数据包报头由基站创建,用于封装来自用户设备的数据包。此外部 GTP-U 数据包的消息类型为 0xFF,长度为 44。此标头正常。内部 GTP-U 报头由用户设备制作并作为数据包发送。与外部一样,此内部 GTP-U 具有 0xFF 作为消息类型,但长度为 0 是不正常的。

The source IP address of the inner packet belongs to the user device, while the source IP address of the outer packet belongs to the base station. Both inner and outer packets have the same destination IP address: that of the UPF.
内部报文的源IP地址属于用户设备,而外包的源IP地址属于基站。内部数据包和外部数据包具有相同的目标 IP 地址:UPF 的 IP 地址。

The UPF decapsulates the outer GTP-U and passes the functional checks. The inner GTP-U packet’s destination is again the same UPF. What happens next is implementation-specific:
UPF 解封装外部 GTP-U 并通过功能检查。内部 GTP-U 数据包的目的地同样是相同的 UPF。接下来发生的事情是特定于实现的:

  • Some implementations maintain a state machine for packet traversal. Improper implementation of the state machine might result in processing this inner GTP-U packet. This packet might have passed the checks phase already since it shares the same packet-context with the outer packet. This leads to having an anomalous packet inside the system, past sanity checks.
    某些实现维护用于数据包遍历的状态机。状态机的不正确实现可能会导致处理此内部 GTP-U 数据包。此数据包可能已经通过了检查阶段,因为它与外部数据包共享相同的数据包上下文。这会导致系统内部有一个异常数据包,通过健全性检查。
  • Since the inner packet’s destination is the IP address of UPF itself, the packet might get sent to the UPF. In this case, the packet is likely to hit the functional checks and therefore becomes less problematic than the previous case.
    由于内部数据包的目的地是 UPF 本身的 IP 地址,因此数据包可能会被发送到 UPF。在这种情况下,数据包可能会遇到功能检查,因此比前一种情况问题更少。

Attack vector 攻击媒介

Some 5G core vendors leverage Open5GS code. For example, NextEPC (4G system, rebranded as Open5GS in 2019 to add 5G, with remaining products from the old brand) has an enterprise offer for LTE/5G, which draws from Open5GS’ code. No attacks or indications of threats in the wild have been observed, but our tests indicate potential risks using the identified scenarios.
一些 5G 核心供应商利用 Open5GS 代码。例如,NextEPC(4G系统,2019年更名为Open5GS,增加了5G,其余产品来自旧品牌)为LTE/5G提供企业报价,该产品借鉴了Open5GS的代码。在野外没有观察到攻击或威胁的迹象,但我们的测试表明了使用已识别场景的潜在风险。

The importance of the attack is in the attack vector: the cellular infrastructure attacks from the UE. The exploit only requires a mobile phone (or a computer connected via a cellular dongle) and a few lines of Python code to abuse the opening and mount this class of attack. The GTP-U in GTP-U attacks is a well-known technique, and backhaul IP security and encryption do not prevent this attack. In fact, these security measures might hinder the firewall from inspecting the content.
攻击的重要性在于攻击媒介:来自UE的蜂窝基础设施攻击。该漏洞只需要一部手机(或通过蜂窝加密狗连接的计算机)和几行 Python 代码即可滥用开口并进行此类攻击。GTP-U 攻击中的 GTP-U 是一种众所周知的技术,回程 IP 安全和加密并不能阻止这种攻击。事实上,这些安全措施可能会阻碍防火墙检查内容。

Remediation and insights 修正和见解

Critical industries such as the medical and utility sectors are just some of the early adopters of private 5G systems, and its breadth and depth of popular use are only expected to grow further. Reliability for continuous, uninterrupted operations is critical for these industries as there are lives and real-world implications at stake. The foundational function of these sectors are the reason that they choose to use a private 5G system over Wi-Fi. It is imperative that private 5G systems offer unfailing connectivity as a successful attack on any 5G infrastructure could bring the entire network down.
医疗和公用事业等关键行业只是私有5G系统的早期采用者之一,其普及的广度和深度预计只会进一步增长。对于这些行业来说,连续、不间断运营的可靠性至关重要,因为这关系到生命和现实世界的影响。这些部门的基本功能是他们选择通过Wi-Fi使用专用5G系统的原因。私有 5G 系统必须提供稳定的连接,因为对任何 5G 基础设施的成功攻击都可能使整个网络瘫痪。

In this entry, the abuse of CVE-2021-45462 can result in a DoS attack. The root cause of CVE-2021-45462 (and most GTP-U-in-GTP-U attacks) is the improper error checking and error handling in the packet core. While GTP-U-in-GTP-U itself is harmless, the proper fix for the gap has to come from the packet-core vendor, and infrastructure admins must use the latest versions of the software.
在此条目中,滥用 CVE-2021-45462 可导致 DoS 攻击。CVE-2021-45462(以及大多数 GTP-U-in-GTP-U 攻击)的根本原因是数据包核心中的错误检查和错误处理不当。虽然 GTP-U-in-GTP-U 本身是无害的,但该差距的正确解决方案必须来自数据包核心供应商,并且基础设施管理员必须使用最新版本的软件。

A GTP-U-in-GTP-U attack can also be used to leak sensitive information such as the IP addresses of infrastructure nodes. GTP-U peers should therefore be prepared to handle GTP-U-in-GTP-U packets. In CT environments, they should use an intrusion prevention system (IPS) or firewalls that can understand CT protocols. Since GTP-U is not normal user traffic, especially in private 5G, security teams can prioritize and drop GTP-U-in-GTP-U traffic.
GTP-U-in-GTP-U 攻击还可用于泄露敏感信息,例如基础设施节点的 IP 地址。因此,GTP-U 对等体应准备好处理 GTP-U-in-GTP-U 数据包。在 CT 环境中,他们应使用可以理解 CT 协议的入侵防御系统 (IPS) 或防火墙。由于 GTP-U 不是正常的用户流量,尤其是在私有 5G 中,安全团队可以优先考虑并丢弃 GTP-U-in-GTP-U 流量。

As a general rule, the registration and use of SIM cards must be strictly regulated and managed. An attacker with a stolen SIM card could insert it to an attacker’s device to connect to a network for malicious deployments. Moreover, the responsibility of security might be ambiguous to some in a shared operating model, such as end-devices and the edge of the infrastructure chain owned by the enterprise. Meanwhile, the cellular infrastructure is owned by the integrator or carrier. This presents a hard task for security operation centers (SOCs) to bring relevant information together from different domains and solutions.
一般来说,SIM卡的注册和使用必须受到严格的监管和管理。拥有被盗 SIM 卡的攻击者可以将其插入攻击者的设备以连接到网络以进行恶意部署。此外,在共享运营模型中,安全责任对于某些人来说可能是模棱两可的,例如终端设备和企业拥有的基础设施链的边缘。同时,蜂窝基础设施归集成商或运营商所有。这给安全运营中心 (SOC) 带来了一项艰巨的任务,即将来自不同领域和解决方案的相关信息汇集在一起。

In addition, due to the downtime and tests required, updating critical infrastructure software regularly to keep up with vendor’s patches is not easy, nor will it ever be. Virtual patching with IPS or layered firewalls is thus strongly recommended. Fortunately, GTP-in-GTP is rarely used in real-world applications, so it might be safe to completely block all GTP-in-GTP traffic. We recommend using layered security solutions that combine IT and communications technology (CT) security and visibility. Implementing zero-trust solutions, such as Trend Micro™ Mobile Network Security, powered by CTOne, adds another security layer for enterprises and critical industries to prevent the unauthorized use of their respective private networks for a continuous and undisrupted industrial ecosystem, and by ensuring that the SIM is used only from an authorized device. Mobile Network Security also brings CT and IT security into a unified visibility and management console.
此外,由于需要停机和测试,定期更新关键基础设施软件以跟上供应商的补丁并不容易,也永远不会如此。因此,强烈建议使用 IPS 或分层防火墙进行虚拟修补。幸运的是,GTP-in-GTP 很少用于实际应用,因此完全阻止所有 GTP-in-GTP 流量可能是安全的。我们建议使用结合了 IT 和通信技术 (CT) 安全性和可见性的分层安全解决方案。实施零信任解决方案,例如由 CTOne 提供支持的 Trend Micro™ Mobile Network Security,为企业和关键行业增加了另一个安全层,以防止未经授权使用各自的专用网络,以实现连续和不中断的工业生态系统,并确保 SIM 卡仅从授权设备使用。移动网络安全还将 CT 和 IT 安全引入统一的可见性和管理控制台。

原文始发于Salim S.I.:Attacks on 5G Infrastructure From Users’ Devices

版权声明:admin 发表于 2024年5月18日 上午10:09。
转载请注明:Attacks on 5G Infrastructure From Users’ Devices | CTF导航

相关文章