Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-95115 Overview
CVE-2026-95115 is a buffer overflow vulnerability in the libwebsockets library, specifically within the LEJP (Lightweight Event-driven JSON Parser) component at commit 106d542c. A remote attacker can trigger an out-of-bounds write [CWE-787] by submitting crafted JSON input with deeply nested arrays, exhausting the parser's internal depth stack. Successful exploitation causes a denial of service against any application or service that embeds libwebsockets and parses untrusted JSON through LEJP.
Critical Impact
Remote, unauthenticated attackers can crash libwebsockets-based services by sending malformed JSON payloads to the LEJP parser, resulting in a denial of service.
Affected Products
- libwebsockets main branch at commit 106d542c
- Applications and services linking the vulnerable lib/misc/lejp.c JSON parser
- Downstream projects embedding unpatched libwebsockets builds
Discovery Timeline
- 2026-10-13 - CVE-2026-95115 published to NVD
- 2026-10-14 - Last updated in NVD database
Technical Details for CVE-2026-95115
Vulnerability Analysis
The flaw resides in lib/misc/lejp.c, the implementation of libwebsockets' LEJP JSON parser. When processing nested JSON arrays, the parser pushes a new depth level onto the fixed-size ctx->i[] stack. The original code incremented ctx->ipos and performed the bounds check only after writing, allowing a write past the end of the array when the maximum depth was reached. An attacker who can submit JSON to any LEJP-backed endpoint can force this condition and crash the process.
Root Cause
The root cause is an off-by-one bounds check ordering error. The pre-patch sequence wrote ctx->i[ctx->ipos++] = 0 before validating that ctx->ipos was within LWS_ARRAY_SIZE(ctx->i). Additionally, the comparison used > rather than >=, so the terminal slot was treated as valid and the following write overflowed the buffer, matching the CWE-787 out-of-bounds write pattern.
Attack Vector
Exploitation requires only network reachability to a service that parses attacker-controlled JSON with LEJP. No authentication or user interaction is required. The attacker sends a JSON document containing array nesting beyond MAX_DEPTH, triggering the overflow and terminating the target process.
// Patch from lib/misc/lejp.c - reorders bounds check before stack write
lejp_check_path_match(ctx);
if (ctx->pst[ctx->pst_sp].callback(ctx, LEJPCB_ARRAY_START))
goto reject_callback;
- ctx->i[ctx->ipos++] = 0;
- if (ctx->flags & LEJP_FLAG_FEAT_LEADING_WC)
- lejp_check_path_match(ctx);
- if (ctx->ipos > LWS_ARRAY_SIZE(ctx->i)) {
+ if (ctx->ipos >= (int)LWS_ARRAY_SIZE(ctx->i)) {
ret = LEJP_REJECT_MP_DELIM_ISTACK;
goto reject;
}
+ ctx->i[ctx->ipos++] = 0;
+ if (ctx->flags & LEJP_FLAG_FEAT_LEADING_WC)
+ lejp_check_path_match(ctx);
goto add_stack_level;
}
if (c != '{') {
Source: libwebsockets commit 736a4a26
Detection Methods for CVE-2026-95115
Indicators of Compromise
- Unexpected crashes, segmentation faults, or restarts of processes linked against libwebsockets shortly after receiving JSON input
- Core dumps implicating lejp_parse or lib/misc/lejp.c in the call stack
- Inbound HTTP, WebSocket, or MQTT payloads containing deeply nested JSON arrays (long sequences of [ characters)
Detection Strategies
- Inspect application and container logs for repeated worker crashes correlated with JSON ingestion endpoints
- Deploy WAF or reverse-proxy rules that reject JSON bodies exceeding a reasonable array nesting depth
- Use fuzzing or runtime instrumentation (AddressSanitizer) in test builds to confirm whether a deployed libwebsockets version is vulnerable
Monitoring Recommendations
- Alert on process restart loops for services known to embed libwebsockets
- Track and version-pin libwebsockets dependencies in software bills of materials (SBOMs) to flag unpatched builds
- Monitor outbound traffic from edge services for crash-induced service degradation and failover events
How to Mitigate CVE-2026-95115
Immediate Actions Required
- Identify all applications, appliances, and container images that embed libwebsockets, especially builds based on the main branch
- Rebuild and redeploy with libwebsockets sources that include commits 736a4a26 and c404a205
- Place a protocol-aware proxy or WAF in front of exposed JSON endpoints to drop pathological payloads until patching is complete
Patch Information
The maintainers resolved the issue in lib/misc/lejp.c by reordering the depth check before the stack write and correcting the comparison operator. The upstream fixes are available in libwebsockets commit 736a4a26 and libwebsockets commit c404a205. Additional context is available in libwebsockets issue #3663.
Workarounds
- Restrict exposure of LEJP-parsed endpoints to trusted networks until patched builds are deployed
- Enforce maximum JSON body size and nesting depth limits at the ingress layer
- Disable or route around optional features that invoke LEJP on untrusted input where feasible
# Rebuild libwebsockets from a patched checkout
git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets
git checkout 736a4a26fce344766bc6618df87bf32193829dd0
mkdir build && cd build
cmake .. -DLWS_WITH_LEJP=ON
make -j"$(nproc)" && sudo make install
sudo ldconfig
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

