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-95114 Overview
CVE-2026-95114 is an out-of-bounds read vulnerability in the libwebsockets Extensible JSON Parser (LEJP) incremental parser. The flaw resides in lib/misc/lejp.c and stems from an off-by-one bounds check when tracking nested array depth. A remote attacker can trigger the condition by submitting crafted JSON input to any application that uses the LEJP parser, causing a denial of service. The weakness is categorized under CWE-125: Out-of-bounds Read. libwebsockets is widely embedded in network-facing applications, IoT firmware, and services that process JSON streams, which expands the exposure surface.
Critical Impact
Remote, unauthenticated attackers can crash services that use the LEJP parser, resulting in a denial-of-service condition against any libwebsockets consumer that processes attacker-influenced JSON.
Affected Products
- libwebsockets library (lib/misc/lejp.c)
- Applications and firmware that embed the LEJP incremental JSON parser
- Downstream projects consuming vulnerable libwebsockets builds
Discovery Timeline
- 2026-10-13 - CVE-2026-95114 published to NVD
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2026-95114
Vulnerability Analysis
The LEJP parser maintains a fixed-size integer stack ctx->i[] to track array indices as it descends into nested JSON structures. When the parser encounters a new array element, it writes to ctx->i[ctx->ipos++] before validating that ipos remains inside the stack bounds. The original guard used a strict greater-than comparison (ctx->ipos > LWS_ARRAY_SIZE(ctx->i)), which permitted writing at and reading one element beyond the valid range. An attacker who supplies deeply nested JSON arrays can drive ipos past the array boundary and force the parser to read adjacent memory. This read triggers undefined behavior and causes the embedding process to abort.
Root Cause
The root cause is an incorrect bounds check combined with ordering of operations. The pre-patch code incremented ipos and performed path matching before checking whether the depth was within LWS_ARRAY_SIZE(ctx->i). The comparison also used > instead of >=, permitting the stack pointer to reach LWS_ARRAY_SIZE and read past the final valid slot.
Attack Vector
Exploitation requires only network access to a service that feeds untrusted JSON into the LEJP parser. No authentication or user interaction is needed. An attacker transmits a JSON payload with array nesting that exceeds LEJP_MAX_DEPTH, triggering the out-of-bounds read and terminating the target process.
// Patch applied to lib/misc/lejp.c - reorders the bounds check and
// changes the comparison from '>' to '>=' before writing to ctx->i[].
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 c404a205
Detection Methods for CVE-2026-95114
Indicators of Compromise
- Unexpected crashes or restarts of services that embed libwebsockets, particularly during JSON ingestion.
- Core dumps referencing lejp_parse or stack frames inside lib/misc/lejp.c.
- Inbound requests containing JSON with extreme array nesting depth followed by a service termination event.
Detection Strategies
- Inventory build manifests and container images for vulnerable libwebsockets versions and confirm patch level against commits 736a4a2 and c404a20.
- Deploy JSON schema or depth-limit validation at the application edge to catch pathological nesting before it reaches the parser.
- Correlate process crash telemetry with recent inbound JSON payloads using an EDR or SIEM pipeline.
Monitoring Recommendations
- Alert on repeated abnormal termination of worker processes handling WebSocket or JSON endpoints.
- Capture and review payloads that trigger LEJP_REJECT_MP_DELIM_ISTACK rejection codes in application logs.
- Monitor network edges for sustained bursts of JSON traffic containing deeply nested arrays targeting libwebsockets-based endpoints.
How to Mitigate CVE-2026-95114
Immediate Actions Required
- Rebuild and redeploy applications linked against libwebsockets using a version that includes commits 736a4a26 and c404a205.
- Audit third-party dependencies and container images to identify embedded libwebsockets copies that need patching.
- Apply ingress validation to reject JSON payloads exceeding a reasonable nesting depth until patched builds are in place.
Patch Information
The maintainers resolved the issue in the libwebsockets repository through two commits that reorder the depth check and correct the comparison operator. See the upstream fix commit, the follow-up commit, and issue #3664 for complete context.
Workarounds
- Place a reverse proxy or API gateway in front of exposed JSON endpoints to enforce maximum payload size and nesting depth.
- Restrict network exposure of libwebsockets-based services to trusted clients until patches are deployed.
- Where feasible, disable code paths that invoke the LEJP incremental parser on untrusted input.
# Example: rebuild libwebsockets from the patched source tree
git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets
git checkout c404a205a98323a7f60e69fae532c5d26bf4a62a
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

