At a glance
- CVE ID(s): CVE-2026-136412
- Severity: CVSS v4.0 score 9.2 (CRITICAL), vector
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
. CVSS v3.1 score 8.1 (HIGH), vectorCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
. Both scores are from VulnCheck. - Vendor / product: OpenResty / stream-lua-nginx-module
- Affected versions: All versions before 0.0.20rc4
- Fixed / patched versions: 0.0.20rc4 (the first version not listed as affected)
- Exploited in the wild: No known exploitation (not listed in CISA KEV)
- Attack vector: Network. No authentication needed. No user interaction. Attack complexity is rated high.
- Published by: VulnCheck (CNA), published 2026-11-24
- Official advisory: VulnCheck advisory
What is this vulnerability?
CVE-2026-136412 is a use-after-free (CWE-416) in the stream-lua-nginx-module. This is the OpenResty module that embeds Lua into the nginx stream (TCP) subsystem.
The bug is in the cosocket
receiveuntil()call. That call returns a pattern iterator, a Lua function you call to read data until a delimiter matches. The module keeps a pointer from the socket to that iterator's compiled pattern.
The Lua garbage collector can free the iterator while the socket still references it. If the connection is then interrupted or closed, later reads or the socket close can use the stale pointer. That is access to freed memory. The result can be a crash or memory corruption in the nginx worker process.
The fix commits change how the module tracks the pattern:
- The socket's link to the pattern is detached after each read, because the iterator may be collected as soon as the read returns to Lua.
- The link is also cleared when the read side of the socket is finalized.
- The pattern is attached to the socket later in the iterator setup, after the earlier steps in that function.
How does it affect you?
The advisory describes the impact as a crash or corruption of the nginx worker. VulnCheck scores confidentiality, integrity and availability impact as high. The advisory text only states crash or corruption. It does not describe code execution or data disclosure.
The realistic risk depends on your setup:
- Attack complexity is rated high. The trigger depends on garbage-collection timing and on the remote peer interrupting or closing the cosocket connection at the right moment.
- The most reliable outcome is a worker crash. nginx normally restarts crashed workers, but repeated crashes can drop active connections and degrade your TCP service.
- Memory corruption in a long-lived worker is harder to reason about. Treat any unexplained worker crash on an affected host as suspicious.
No exploitation in the wild is known. It is not in CISA KEV. Still, a CVSS v4.0 score of 9.2 means you should schedule the upgrade soon, not leave it for routine maintenance.
Who is affected?
You are affected if all of these are true:
- You run nginx or OpenResty with stream-lua-nginx-module, version before 0.0.20rc4.
- Your Lua code in the stream subsystem uses cosocket
receiveuntil()
. Examples are code undercontent_by_lua_block
orpreread_by_lua_block
that reads from an upstream or other TCP socket. - The cosocket connection can be influenced by a remote peer, for example by being closed or interrupted.
The advisory does not say that the HTTP module (ngx_http_lua_module) is affected. This CVE is about the stream module only. If you only use Lua in
httpblocks, this CVE does not apply to that code path, but check whether a stream block also exists.
How to check if you are vulnerable
First, find out whether the stream Lua module is in your build. Run this to list the build options and look for lua entries:
nginx -V 2>&1 | tr ' ' '\n' | grep -i lua
openresty -V 2>&1 | tr ' ' '\n' | grep -i lua
Use whichever binary you run. If the module is built as a dynamic module, also check the
load_modulelines in your nginx configuration.
Next, find out which module version you have. The advisory does not give a command for this. Check your OpenResty or package version and compare the bundled stream-lua-nginx-module version with 0.0.20rc4. Your vendor or package maintainer should be able to tell you. If you built from source, check the source tree you used.
Then look for usage. Search your configuration and Lua files for
receiveuntil:
grep -rn receiveuntil /etc/nginx /usr/local/openresty
Adjust the paths to where your configs and Lua files live. A hit inside stream-context Lua code on a vulnerable module version means you are exposed.
How to fix and recover
- Upgrade stream-lua-nginx-module to 0.0.20rc4 or later. If you use OpenResty packages, install a build that bundles the fixed module. If your package does not yet include it, ask your vendor. Do not assume a distribution package has the fix.
- Rebuild and reload. If you compile nginx with the module, rebuild with the fixed source. A configuration reload does not replace the binary, so restart nginx with the new binary.
- Verify. Confirm the new binary is running and that the bundled module is 0.0.20rc4 or later. Re-run the build-option check above. Then test your stream services under normal traffic.
- Review for signs of impact. Check the nginx error log for worker crashes (signal messages such as segmentation faults) from before the upgrade. Repeated crashes on a stream listener are a sign someone may have been probing it.
The advisory does not report data theft or code execution. If you saw unexplained crashes and your stream service handles sensitive data, consider rotating any credentials or keys that the Lua code handles. Restore a known-good configuration if you find unexpected changes.
The upstream fixes are in two commits: 7581c68 and 9591e20. The fixed release is v0.0.20rc4. Applying the commits to an older source tree is possible, but moving to the release is safer.
Workarounds and mitigations
The advisory lists no official workarounds. Upgrading is the fix.
If you cannot upgrade right away, these general steps may reduce exposure. They are not vendor-approved:
- Restrict who can reach affected stream listeners with firewall rules or
allow
/deny
controls, so only trusted peers connect. - Where it is practical, avoid
receiveuntil()
in stream Lua code until the module is patched. - Keep process supervision and alerting on, so worker crashes are noticed fast.
What to monitor
- nginx error logs for worker processes exiting on a signal, especially segmentation faults, and repeated worker respawns.
- Sudden resets or drops on stream (TCP) services that use Lua.
- Unusual patterns of connections that open and then close or abort early on those listeners.
- Core dumps from nginx workers, if you collect them. Keep them for analysis.
- The OpenResty release notes and your distribution's security feed for a packaged fix.
