open5gs/lib
Sukchan Lee 6a29f11115 proto: Prevent SMF crash on malformed PCO/EPCO during parsing
ogs_pco_parse() previously relied on ogs_assert() to verify the bounds
of Protocol/Container fields while parsing PCO/EPCO data. If the outer
PCO/EPCO length was inconsistent with the internal container encoding
(e.g., truncated Container-ID, Container-Length, or container data),
the assert would trigger and terminate the process.

Because PCO/EPCO is derived from UE-supplied NAS messages (e.g.,
PDU Session Establishment Request), a malformed EPCO IE could trigger
a remote SMF crash, resulting in a denial-of-service condition.

This patch replaces the assert-based bounds checks with explicit
runtime validation and returns an error when malformed or truncated
PCO/EPCO is detected. The SMF can then reject the request cleanly
instead of aborting.

Checks added:
- Validate minimum PCO/EPCO length before accessing header fields
- Verify Container-ID bounds
- Verify Container-Length bounds
- Verify container payload length
- Detect container count overflow beyond
  OGS_MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID

With these changes, malformed EPCO inputs are safely rejected and the
SMF remains operational.

Issues: #4341
2026-03-10 22:35:42 +09:00
..
app [MME] Add Emergency Number List to "Attach Accept" NAS message 2025-10-27 21:28:53 +09:00
asn1c [MME] unify TAU procedure handling and BCS check across all S1AP cases(#4112, #4113, #4117) 2025-10-25 21:31:45 +09:00
core core/tlv, smf: Harden TLV parsing and validate Bearer Context in CSR 2026-03-06 10:05:24 +09:00
crypt clang scan-build static analysis findings/resolutions (#3387) 2024-08-16 16:42:12 +09:00
dbi Merge branch 'main' into home-routed 2025-04-06 18:37:36 +09:00
diameter [MME] S6a ULR: Add SMS-Register-Request AVP with SMS in MME Not Preferred 2026-02-25 22:34:31 +09:00
gtp gtp2: Add runtime boundary validation in ogs_gtp2_parse_tft() 2026-02-28 22:17:00 +09:00
ipfw pfcp/ipfw: Improve error handling in PDR creation/update and ipfw rule parsing 2025-11-20 16:39:17 +09:00
metrics [metrics] fix memory leak 2025-11-13 20:02:25 +09:00
nas Follow up on #4102 2025-10-27 21:31:21 +09:00
ngap [MME/AMF] Fixed crash following Handover Request (#3014) 2024-02-29 23:02:38 +09:00
pfcp pfcp: add defensive resets for FAR/URR optional fields in Create handlers 2026-03-10 22:02:58 +09:00
proto proto: Prevent SMF crash on malformed PCO/EPCO during parsing 2026-03-10 22:35:42 +09:00
s1ap [Release-17] Upgrade S1AP/NGAP to v17.3.9 2023-02-21 21:48:06 +09:00
sbi sbi: prevent AMF abort on malformed multipart SBI requests 2026-03-08 19:59:17 +09:00
sctp [PFCP] Refactor PFCP address handling (#3431) 2025-01-11 20:33:02 +09:00
tun [AMF] Follow-up on #3880 2025-06-17 17:34:18 +09:00
meson.build [SEPP] Initial Update for 5G Roaming (#2739) 2023-11-19 19:34:51 +09:00