Summary
OpenResty stream-lua-nginx-module versions before 0.0.20rc4 contain a use-after-free vulnerability (CWE-416). It occurs when a receiveuntil() pattern iterator is garbage-collected while the socket still references it. Later reads or socket closure then use the stale pointer to freed memory.
The attack is network-based and requires no authentication or user interaction, but attack complexity is high (AC:H): a remote peer must interrupt or close the cosocket connection at the right moment. The CVSS score is 8.1 (High).
The result is a crash or memory corruption of the nginx worker process. Per the CVSS vector, the impact on confidentiality, integrity and availability can be high. The flaw is not listed in CISA KEV, and the EPSS probability of exploitation is about 0.95%.
Who is affected
Organizations running OpenResty/nginx with stream-lua-nginx-module older than 0.0.20rc4, especially where Lua code uses cosocket receiveuntil().
What to do
- Upgrade stream-lua-nginx-module to version 0.0.20rc4 or later (fixed in GitHub commits 9591e20 and 7581c68).
- Inventory systems running the OpenResty/nginx stream module and check the bundled stream-lua-nginx-module version.
- Review Lua code in the stream context to determine whether receiveuntil() is used on cosockets.
- The vendor has not published a workaround. Until you upgrade, monitor logs for unexpected nginx worker crashes.
Affected products and versions
CVSS vector, explained
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- Network (from the internet)
- Attack complexity
- High
- Privileges required
- None (no login)
- User interaction
- Not required
- Scope
- Vulnerable component only
- Confidentiality
- High impact
- Integrity
- High impact
- Availability
- High impact
Weakness type (CWE)
- CWE-416 Use After Free
References
- github.com/openresty/stream-lua-nginx-module/commit/9591e20ab754e78437b7519053ff496aca25f5 patch
- github.com/openresty/stream-lua-nginx-module/commit/7581c68b43e1645bffe0d7262b1f4230d9698a patch
- github.com/openresty/stream-lua-nginx-module/tree/v0.0.20rc4
- github.com/openresty/stream-lua-nginx-module/blob/7581c68b43e1645bffe0d7262b1f4230d9698a6a
- www.vulncheck.com/advisories/openresty-stream-lua-nginx-module-before-0.0-20rc4-use-after-
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.