CVE-2023-27730

7.5 HIGH

📋 TL;DR

CVE-2023-27730 is a memory corruption vulnerability in Nginx NJS JavaScript engine that can cause segmentation faults via the njs_lvlhsh_find function. This affects systems running Nginx with NJS module enabled, potentially leading to denial of service or arbitrary code execution. The vulnerability is present in NJS version 0.7.10 and earlier.

💻 Affected Systems

Products:
  • Nginx NJS (JavaScript engine for Nginx)
Versions: NJS version 0.7.10 and earlier
Operating Systems: All operating systems running Nginx with NJS module
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when NJS module is explicitly enabled and configured in Nginx. Standard Nginx installations without NJS are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise if the segmentation violation can be weaponized to execute arbitrary code.

🟠

Likely Case

Denial of service through Nginx worker crashes, causing service disruption and potential availability issues.

🟢

If Mitigated

Limited impact with proper segmentation and privilege separation, potentially only affecting individual worker processes.

🌐 Internet-Facing: HIGH - Nginx is commonly deployed as an internet-facing web server/proxy, making exposed instances vulnerable to remote attacks.
🏢 Internal Only: MEDIUM - Internal Nginx instances with NJS enabled remain vulnerable but have reduced attack surface compared to internet-facing deployments.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

The GitHub issue includes technical details and proof-of-concept information. Exploitation requires triggering the vulnerable function through NJS JavaScript execution.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: NJS version 0.7.11 and later

Vendor Advisory: https://github.com/nginx/njs/issues/615

Restart Required: Yes

Instructions:

1. Update NJS to version 0.7.11 or later. 2. Recompile Nginx with updated NJS module if using source build. 3. Restart Nginx service to apply changes.

🔧 Temporary Workarounds

Disable NJS Module

all

Remove or disable NJS module configuration in Nginx if not required

# Remove njs module from nginx configuration
# Comment out or remove 'load_module modules/ngx_http_js_module.so;' from nginx.conf
# Remove any js_* directives from server/location blocks

Restrict NJS Usage

all

Limit NJS execution to trusted contexts only

# In nginx.conf, restrict js_content/js_set directives to specific locations
location /trusted {
    js_content handler;
}
# Add authentication/authorization before NJS execution

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate vulnerable Nginx instances
  • Deploy web application firewall (WAF) rules to detect and block suspicious NJS-related requests

🔍 How to Verify

Check if Vulnerable:

Check NJS version: njs -v or examine nginx configuration for NJS module loading and version

Check Version:

njs -v 2>/dev/null || grep -i njs /path/to/nginx/conf/nginx.conf

Verify Fix Applied:

Verify NJS version is 0.7.11 or later: njs -v should show version >= 0.7.11

📡 Detection & Monitoring

Log Indicators:

  • Segmentation fault errors in Nginx error logs
  • Worker process crashes with signal 11 (SIGSEGV)
  • Repeated NJS-related errors

Network Indicators:

  • Unusual patterns of requests to NJS-enabled endpoints
  • Requests containing malformed JavaScript or unusual parameters

SIEM Query:

source="nginx-error.log" AND ("segmentation fault" OR "signal 11" OR "SIGSEGV")

🔗 References

📤 Share & Export