Skip to content

AMF Crashes on sending PDUSessionResourceModifyIndication before establishing NG Context #681

Description

@shovon0203

AMF crashes when a PDUSessionResourceModifyIndication is sent before appropriate NG Context is established. Nil Pointer Deference.

Reproduction Step:
Send the following NGAP message
00 1B 00 24 00 00 02 00 0A 00 02 00 00 FF FF 40 05 00 3A 41 EA EB FF FF 00 0E 00 80 00 0A 82 80 FF F7 4C 7E D9 03 3F 00

AMF Version: 2.0.2

AMF Log:

2026-02-10T00:50:52.165Z	INFO	ngap/dispatcher.go:132	Create a new NG connection for: 127.0.0.1:39609	{"component": "AMF", "category": "NGAP"}
2026-02-10T00:50:52.166Z	ERROR	context/db.go:221	DbFetchRanUeByAmfUeNgapID: no document found for amfUeNgapID  0	{"component": "AMF", "category": "DBRepo"}
2026-02-10T00:50:52.166Z	ERROR	context/context.go:547	ranUe not found with AmfUeNgapID	{"component": "AMF", "category": "Context"}
2026-02-10T00:50:52.167Z	INFO	ngap/handler.go:2152	handle PDU Session Resource Modify Indication	{"component": "AMF", "category": "NGAP", "ran_addr": "127.0.0.1:39609"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1375646]
goroutine 444 gp=0xc000603500 m=3 mp=0xc000089008 [running]:
panic({0x1624140?, 0x26d9d20?})
	/usr/local/go/src/runtime/panic.go:802 +0x168 fp=0xc000953958 sp=0xc0009538a8 pc=0x481128
runtime.panicmem(...)
	/usr/local/go/src/runtime/panic.go:262
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:925 +0x359 fp=0xc0009539b8 sp=0xc000953958 pc=0x483ab9
github.com/omec-project/amf/ngap.HandlePDUSessionResourceModifyIndication({0x1b36a58, 0xc0003525d0}, 0xc0005ca280, 0xc00036e440)
	/go/src/amf/ngap/handler.go:2198 +0x926 fp=0xc000953ca0 sp=0xc0009539b8 pc=0x1375646
github.com/omec-project/amf/ngap.DispatchNgapMsg({0x1b369a0, 0x2734720}, 0xc0005ca280, 0xc00036e440, 0x0)
	/go/src/amf/ngap/dispatcher.go:271 +0xb1d fp=0xc000953fa8 sp=0xc000953ca0 pc=0x136413d
github.com/omec-project/amf/ngap.Dispatch.gowrap1()
	/go/src/amf/ngap/dispatcher.go:169 +0x2e fp=0xc000953fe0 sp=0xc000953fa8 pc=0x136356e
runtime.goexit({})
	/usr/local/go/src/runtime/asm_amd64.s:1693 +0x1 fp=0xc000953fe8 sp=0xc000953fe0 pc=0x489ca1
created by github.com/omec-project/amf/ngap.Dispatch in goroutine 333
	/go/src/amf/ngap/dispatcher.go:169 +0x5c6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions