针对 S2OPC(Safe & Secure OPC)中 CVE-2026-90782 的独立概念验证。
在 alloc_notification_message_items() 中(S2OPC 1.7.3 及更早版本):
status 变量同时用于 DataChange 和 Event 的分配。status 会被覆盖为 SOPC_STATUS_OK。dataChangeNotif 指针 → NULL 解引用 / 崩溃。gcc -o s2opc_poc reproducer.c
# Test 1 — both allocations succeed (no crash)
./s2opc_poc 1
# Test 2 — vulnerable path: DataChange fails, Event succeeds → NULL deref (crash)
./s2opc_poc 2
# Test 3 — fixed path: independent status tracking, no crash
./s2opc_poc 3
# Test 4 — control: data-only (no Event alloc to clobber status)
./s2opc_poc 4
推荐配合 AddressSanitizer 使用:
gcc -fsanitize=address -g -o s2opc_poc reproducer.c
./s2opc_poc 2
独立跟踪各分配状态,并在 DataChange 分配失败时提前退出 / 跳过解引用。与提交 8848f051 中的模式一致。
reproducer.c — 复现了存在漏洞和已修复的分配逻辑