You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any client that can complete the WebSocket handshake (no obs-websocket auth
needed — parsing happens before the op-code/session checks) can crash OBS
with a stack overflow by sending a deeply nested JSON or MsgPack message.
Trace:
plugins/obs-websocket/src/websocketserver/WebSocketServer.cpp:379 incomingMessage = json::parse(payload); and :394 json::from_msgpack(payload) run on the raw frame payload inside the
QThreadPool runnable, before IsIdentified() / op validation
(ProcessMessage is only called at :436).
nlohmann::json 3.11.3 (bundled via obs-deps) parses containers by
recursive-descent sax_parse: every [/{ costs one C++ stack frame.
A payload of e.g. 1–4 MB of [ characters yields hundreds of thousands
of nesting levels — far beyond a worker-thread stack (~512 KB–8 MB).
The only catch is json::parse_error; a stack overflow is not an
exception — the thread (and process) dies.
Reproducer sketch: connect to the obs-websocket port, send a text frame
consisting of "[" repeated ~500k times followed by matching ]
(websocketpp's default max message size permits it). OBS aborts with a
stack overflow / SIGSEGV in the parser.
Suggested fix: cap message size and/or pre-scan nesting depth before json::parse (or iterate with a depth counter and reject past a bound
such as 512 levels). Same bound applies to from_msgpack, whose
container parsing also recurses per nesting level.
Note on upstream OBS Studio: this bug very likely affects obsproject/obs-studio too. We would report it there, but OBS Studio bans AI-assisted contributions, and in the owner's view they're probably too woke to handle it anyway, so we're keeping it here. The websocket JSON/MsgPack depth fix is still in progress on our side.
Claiming: pre-auth JSON/MsgPack nesting crash. Plan: (1) add a black-box regression for over-deep frames against the C++ server and verify RED; (2) bound frame size and container depth before nlohmann parsing for text and binary; (3) verify GREEN with the full Tier 4 suite, run the required local gate, and open a PR targeting master. Expected first PR: today.
Fixed in #477 (merge ba4922b) using the bounded JSON/MsgPack parser from obs-rust/obs-websocket#2. The RED Tier 4 case sent an over-deep valid JSON envelope that the original in-tree plugin failed to reject with 4002; the built fixed app returns 4002 for both JSON and MsgPack and remains alive. Lint, unit suite, symbol parity, and stamped local gate passed. A separate intermittent full Tier 4 crash also reproduces with the original plugin and is tracked in #476.
Activity
chriscoveries commentedon Oct 11, 2026
Note on upstream OBS Studio: this bug very likely affects obsproject/obs-studio too. We would report it there, but OBS Studio bans AI-assisted contributions, and in the owner's view they're probably too woke to handle it anyway, so we're keeping it here. The websocket JSON/MsgPack depth fix is still in progress on our side.
zackees commentedon Oct 13, 2026
Claiming: pre-auth JSON/MsgPack nesting crash. Plan: (1) add a black-box regression for over-deep frames against the C++ server and verify RED; (2) bound frame size and container depth before nlohmann parsing for text and binary; (3) verify GREEN with the full Tier 4 suite, run the required local gate, and open a PR targeting master. Expected first PR: today.
zackees commentedon Oct 13, 2026
Fixed in #477 (merge ba4922b) using the bounded JSON/MsgPack parser from obs-rust/obs-websocket#2. The RED Tier 4 case sent an over-deep valid JSON envelope that the original in-tree plugin failed to reject with 4002; the built fixed app returns 4002 for both JSON and MsgPack and remains alive. Lint, unit suite, symbol parity, and stamped local gate passed. A separate intermittent full Tier 4 crash also reproduces with the original plugin and is tracked in #476.
obs-websocket: Restore the bounded websocket parser (#497)
obs-websocket: Restore the bounded websocket parser again (#502)
obs-websocket: Restore the bounded parser submodule pointer