The short version
- Affected: stream-lua-nginx-module below 0.0.20rc4, which means every OpenResty release up to and including 1.31.8.1 (CVE record, 1.31.8.1 changelog). Stock nginx without this module is not affected.
- Fixed in: module 0.0.20rc4, tagged 17 November 2026, bundled in OpenResty 1.31.9.1 released 23 November 2026 (1.31.9.1 changelog).
- Severity: CVSS 4.0 9.2 Critical and CVSS 3.1 8.1 High, both from VulnCheck as the CVE Numbering Authority. NVD lists the record as Received, with no analysis yet.
- Exploited: not known. No source reports attacks and the CVE is not in KEV. A GitHub repository named after the CVE appeared on 25 November 2026 claiming a crash reproducer; it is unverified (Brandefense).
- Do now: check whether any
streamserver in your nginx config runs Lua that callsreceiveuntil(). If yes, upgrade to OpenResty 1.31.9.1 or rebuild with module 0.0.20rc4.
1. What CVE-2026-136412 is
OpenResty bundles nginx with Lua modules. The HTTP side is lua-nginx-module. The TCP and UDP side is stream-lua-nginx-module, which adds preread_by_lua_block and content_by_lua_block to the stream block and gives that Lua a cosocket API for talking to clients and upstreams (module README). One cosocket method, tcpsock:receiveuntil(pattern), returns an iterator that reads until it sees a delimiter (lua-nginx-module README).
The compiled pattern object and the socket pointed at each other. When Lua's garbage collector freed the pattern while the socket still referenced it, a later read or the socket's own cleanup followed the stale pointer into freed memory (CVE record). A remote peer triggers this by interrupting or closing the connection while a receiveuntil() read is pending; nothing unusual needs to be sent.
The fix came in two commits. The first, tagged v0.0.20rc3 on 16 September 2026, detaches the pattern from the socket when the read side is finalised (commit 7581c68). The second detaches it after every read, covering cancellation and close paths the first missed (commit 9591e20). VulnCheck lists both as the patch and sets the fixed version at 0.0.20rc4, so treat rc3 as incomplete. The same flaw on the HTTP side was fixed in lua-nginx-module without a CVE (issue 2517). The finder is credited as Nuno of Maze HQ.
2. Impact: who is exposed and how badly
You are exposed only if three things are true: the module is compiled into your nginx, your config has a stream server that runs Lua, and that Lua calls receiveuntil() on a socket a remote party can close. OpenResty's build script turns the stream Lua module on unless you configure with --without-stream (OpenResty configure), so most OpenResty binaries carry the code, but it does nothing until a stream block uses it. The usual cases are custom TCP proxies, protocol gateways and the stream features of API gateways built on OpenResty.
The worst outcome in the advisory is a crashed or corrupted nginx worker. A crash drops every connection that worker held; nginx restarts the worker. Corruption is why VulnCheck rates confidentiality, integrity and availability all High, though no source shows this bug turned into code execution. The vector marks attack complexity High and attack requirements Present: the attacker needs a vulnerable Lua code path and timing, not just network access.
| What you run | Module version | Status |
|---|---|---|
| OpenResty 1.31.9.1 (23 Nov 2026) | 0.0.20rc4 | Fixed (changelog) |
| OpenResty 1.31.8.1 (26 Oct 2026) | 0.0.20rc3 | Partial fix only, upgrade (changelog) |
| OpenResty 1.31.1.1 (13 May 2026) | 0.0.19 | Affected (changelog) |
| OpenResty 1.29.2.3 to 1.29.2.5 | 0.0.18rc2 to 0.0.19rc3 | Affected (changelog, bundle script) |
| Older OpenResty, any source build with the module below 0.0.20rc4 | below 0.0.20rc4 | Affected |
openresty/openresty Docker tags 1.31.9.1-*, 1.31-*, latest | 0.0.20rc4 | Fixed (Docker Hub) |
Alpine Linux openresty package, edge | 1.31.8.1-r0 | Partial fix only (Alpine packages) |
Alpine Linux openresty package, v3.21 to v3.23 | 1.27.1.1-r1 and 1.27.1.2-r2, module 0.0.16 | Affected (Alpine packages, bundle script) |
Not affected: nginx from nginx.org or from Debian, Ubuntu, Alpine or Red Hat packages. Those distributions package the HTTP Lua module but none packages the stream Lua module, so there is nothing for them to patch (Debian packages, Alpine packages, Debian security tracker). OpenResty installs with no stream block, or whose stream Lua never calls receiveuntil(), carry the code but have no known trigger.
3. How to check if you are affected
- Read the version out of the binary. OpenResty's
openrestycommand is nginx, and-Vprints the version and configure arguments (nginx switches). The bundle adds the module from a directory namedngx_stream_lua-<version>(OpenResty build script). You wantopenresty/1.31.9.1andngx_stream_lua-0.0.20rc4. If nongx_stream_luaor stream-lua--add-moduleline appears, the module is not compiled in.
openresty -V 2>&1 | tr ' ' '\n' | grep -E 'openresty/|ngx_stream_lua|stream-lua'
nginx -V 2>&1 | tr ' ' '\n' | grep -E 'nginx/|ngx_stream_lua|stream-lua'
- Find out whether any stream server runs Lua that calls receiveuntil.
-Ttests the config and dumps every included file (nginx switches). Then search the Lua files the config loads.
openresty -T 2>/dev/null | grep -n -E '^\s*stream\s*\{|preread_by_lua|content_by_lua|lua_code_cache'
grep -rn 'receiveuntil' /usr/local/openresty/nginx/conf/ /usr/local/openresty/site/ /etc/openresty/ 2>/dev/null
- Packages on a host. OpenResty's Linux packages are all named
openresty(OpenResty Linux packages). Anything below 1.31.9.1 is affected or partially fixed.
dpkg -l openresty 2>/dev/null | tail -1
rpm -q openresty 2>/dev/null
apk info openresty 2>/dev/null
- Container images. The official image labels each build with
resty_versionand its tags start with the OpenResty version (docker-openresty README). Check the image you deploy; floating tags such aslatestand1.31-bookwormalready moved to 1.31.9.1.
docker inspect --format '{{index .Config.Labels "resty_version"}}' openresty/openresty:1.31-bookworm
docker run --rm openresty/openresty:1.31.9.1-bookworm openresty -V 2>&1 | tr ' ' '\n' | grep -E 'openresty/|ngx_stream_lua'
grep -i '^FROM openresty' Dockerfile
- Kubernetes and AWS ECS. List the image every workload runs and compare against step 4. Products built on OpenResty ship their own copy; ask their vendor which release they bundle.
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{" "}{.spec.containers[*].image}{"\n"}{end}' | grep -i openresty
aws ecs describe-task-definition --task-definition <family> --query 'taskDefinition.containerDefinitions[*].image'
4. How to fix it
- Pick the target. OpenResty 1.31.9.1 for any OpenResty install. For a hand-built nginx, stream-lua-nginx-module tag v0.0.20rc4 or later (tags). Do not stop at 1.31.8.1 or module 0.0.20rc3; they carry only the first of the two fix commits.
- Packages from the OpenResty repositories. The vendor's documented install commands also pull the newest version once the index is refreshed (OpenResty Linux packages). These change the system.
sudo apt-get update && sudo apt-get install openresty # Debian, Ubuntu
sudo dnf check-update; sudo dnf install openresty # RHEL 8+, Fedora, Amazon Linux 2023
sudo apk update && sudo apk add openresty # Alpine, from the openresty.org repo
Alpine's own community package is 1.31.8.1-r0 in edge, built 7 November 2026, and 1.27.1.x in the v3.21 to v3.23 stable branches, with no fixed build in any branch yet; use OpenResty's Alpine repository or a container image instead.
- Containers. Change the
FROMline to a fixed tag such asopenresty/openresty:1.31.9.1-bookworm,openresty/openresty:1.31.9.1-alpine-fatoropenresty/openresty:1.31.9.1-noble, rebuild, and roll the Deployment or ECS service (Docker Hub). Thealpineflavour builds 1.31.9.1 from source with--with-stream(Dockerfile).
- Source builds. Build from the
openresty-1.31.9.1.tar.gzbundle (download), or point--add-moduleat a checkout of tag v0.0.20rc4.
- Restart, do not just reload. A
reloadstarts new workers from the old master binary. Replacing the binary needs a full service restart, or nginx's documented on-the-fly upgrade with the USR2 signal (nginx control). Then repeat check step 1 against the running process: it should printopenresty/1.31.9.1andngx_stream_lua-0.0.20rc4.
5. If you cannot patch today
OpenResty and VulnCheck publish no workaround. The only vendor-documented remediation is the upgrade. Generic exposure cuts that follow from the bug's shape:
- Restrict who can reach
streamlisteners whose Lua callsreceiveuntil(), by firewall, security group orallowanddenyin the stream block. The attacker must be a peer of that socket. - Replacing
receiveuntil()with sizedreceive()calls avoids the vulnerable path. That is an application change you must test, not a vendor step. - Alert on nginx worker exits so a crash is noticed.
None of these fix the code. Upstream sockets count too: a compromised upstream that closes connections mid-read is also a remote peer.
6. How to tell if you were already hit
Nothing is published. The CVE record, the VulnCheck advisory and the write-ups we read give no indicators of compromise, no log signature and no report of attacks (Brandefense). The visible symptom is an nginx worker crash, so review the error log and core dumps for worker exits that line up with connections to your stream Lua services. A worker restart alone proves neither exploitation nor its absence (dev.to).
If you suspect code execution, assume the usual pattern: the attacker reads credentials from the worker's environment and configuration and uses them from elsewhere. Rotate anything the nginx process could read.
7. How autonomous DevOps handles a bug like this
Check steps 4 and 5 above are inventory questions: which openresty/openresty tag each ECS task definition runs, and what each Dockerfile's FROM line pins. Compass, Beamreach's open-source operations agent for AWS, keeps that map current along with whether the workload faces the internet, so the answer on 24 November is a lookup rather than a sweep (Compass). nginx is on its default product list and the CVE scores 9.2, above its 7.0 threshold, so when the finding matches an image on the map it opens a fix without a click.
When OpenResty comes from the official image, the fix is the kind of change its patch pull requests make: a base image tag from openresty/openresty:1.31.8.1-bookworm to openresty/openresty:1.31.9.1-bookworm. The pull request runs the repository's CI and the image build, plus an optional canary on a staging copy that compares health checks, 5xx rate and p95 latency with before. Compass never merges (patching docs).
The limits are real here. Steps 1 and 2, reading the module version from the binary and finding receiveuntil() calls in Lua, are not things Compass does; it does not watch processes in a container. OpenResty installed from openresty.org's own package repository is not covered by the Ubuntu, Debian or Alpine trackers Compass follows, and a source build with --add-module is a code change, so both wait in the inbox for a person. Compass covers AWS only, not Kubernetes clusters as such.
For the window before the fix is deployed, a honeytoken is a partial answer. A decoy AWS key or database login in the task's environment trips only if memory corruption becomes code execution and the attacker uses it, and the policy-gated restart does not fix the vulnerability. Our PHP2Shell incident in October 2026 was contained that way in under two minutes (write-up).
8. Sources
- VulnCheck advisory: https://www.vulncheck.com/advisories/openresty-stream-lua-nginx-module-before-0.0-20rc4-use-after-free-via-cosocket-receiveuntil
- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-136412
- CVE record JSON: https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2026/136xxx/CVE-2026-136412.json
- NVD entry: https://nvd.nist.gov/vuln/detail/CVE-2026-136412
- Fix commit 7581c68 (v0.0.20rc3): https://github.com/openresty/stream-lua-nginx-module/commit/7581c68b43e1645bffe0d7262b1f4230d9698a6a
- Fix commit 9591e20 (v0.0.20rc4): https://github.com/openresty/stream-lua-nginx-module/commit/9591e20ab754e78437b7519053ff496aca25f531
- stream-lua-nginx-module v0.0.20rc4: https://github.com/openresty/stream-lua-nginx-module/tree/v0.0.20rc4
- stream-lua-nginx-module tags: https://github.com/openresty/stream-lua-nginx-module/tags
- lua-nginx-module issue 2517 (HTTP side): https://github.com/openresty/lua-nginx-module/issues/2517
- lua-nginx-module README, tcpsock:receiveuntil: https://raw.githubusercontent.com/openresty/lua-nginx-module/master/README.markdown
- OpenResty 1.31.9.1 changelog: https://openresty.org/en/changelog-1031009.html
- OpenResty 1.31.8.1 changelog: https://openresty.org/en/changelog-1031008.html
- OpenResty 1.31.1.1 changelog: https://openresty.org/en/changelog-1031001.html
- OpenResty 1.29.2.x changelog: https://openresty.org/en/changelog-1029002.html
- OpenResty downloads: https://openresty.org/en/download.html
- OpenResty Linux packages: https://openresty.org/en/linux-packages.html
- OpenResty bundle configure script: https://raw.githubusercontent.com/openresty/openresty/master/util/configure
- OpenResty bundle tarball script: https://raw.githubusercontent.com/openresty/openresty/master/util/mirror-tarballs
- docker-openresty README: https://github.com/openresty/docker-openresty
- docker-openresty alpine Dockerfile: https://raw.githubusercontent.com/openresty/docker-openresty/master/alpine/Dockerfile
- Docker Hub, openresty/openresty: https://hub.docker.com/r/openresty/openresty
- nginx command-line switches: https://nginx.org/en/docs/switches.html
- nginx, controlling nginx and upgrading the executable: https://nginx.org/en/docs/control.html
- Alpine openresty package: https://pkgs.alpinelinux.org/packages?name=openresty&branch=edge
- Alpine nginx-mod-http-lua package: https://pkgs.alpinelinux.org/packages?name=nginx-mod-http-lua&branch=edge
- Debian libnginx-mod-http-lua package: https://packages.debian.org/search?keywords=libnginx-mod-http-lua
- Debian security tracker: https://security-tracker.debian.org/tracker/CVE-2026-136412
- Brandefense, 25 November 2026: https://brandefense.io/knowledge-hub/vulnerabilities/cve-2026-136412/
- dev.to, 25 November 2026: https://dev.to/sorrelthorncroft/a-lua-pattern-iterator-must-not-outlive-the-socket-9fj
- Compass patching docs: https://github.com/beamreach-ai/compass/blob/main/docs/patching.md
- PHP2Shell contained in two minutes: https://beamreach.ai/docs/php2shell-contained-in-two-minutes.html
9. FAQ
Is my nginx affected by CVE-2026-136412?
Only if it was built with OpenResty's stream-lua-nginx-module below 0.0.20rc4, which covers every OpenResty release up to 1.31.8.1 and any custom build that adds the module. Run openresty -V or nginx -V and look for ngx_stream_lua- or stream-lua in the configure arguments. Plain nginx from nginx.org or a Linux distribution is not affected. Even on an affected binary, the bug needs a stream server whose Lua calls receiveuntil().
Which OpenResty version fixes CVE-2026-136412?
OpenResty 1.31.9.1, released 23 November 2026, which bundles stream-lua-nginx-module 0.0.20rc4. OpenResty 1.31.8.1 bundles 0.0.20rc3, which has only the first of the two fix commits, and VulnCheck sets the fixed version at 0.0.20rc4, so 1.31.8.1 is not enough. Docker tags openresty/openresty:1.31.9.1-* are on Docker Hub.
Is CVE-2026-136412 being exploited?
Not as far as anyone has reported by 25 November 2026. It is not in CISA's Known Exploited Vulnerabilities catalogue and no vendor or researcher reports attacks. A GitHub repository with the CVE's name, created on 25 November, claims a crash reproducer; it is unverified, and a crash reproducer is not an attack report.
Is there a workaround for the OpenResty stream Lua use-after-free?
No. OpenResty and VulnCheck document only the upgrade. Until you upgrade, restrict who can reach stream listeners whose Lua uses receiveuntil(), and watch for worker crashes. Replacing receiveuntil() with sized receive() calls avoids the vulnerable path but is an application change you would have to test yourself.
Does CVE-2026-136412 affect the HTTP side of OpenResty, lua-nginx-module?
No. The CVE covers only stream-lua-nginx-module. The equivalent HTTP-side bug was fixed in lua-nginx-module v0.10.32rc7, bundled in OpenResty 1.31.8.1, without a CVE (1.31.8.1 changelog). OpenResty 1.31.9.1 fixes both.
Last checked: 25 November 2026. Written from the vendor advisory and the CVE record, linked below. Confirm against the vendor advisory before acting.
Related: CVE Watch: all pages · How to protect against *2Shell vulnerabilities · Automated patching compared · AWS canary credentials
Beamreach