CVE-2024-4148

7.5 HIGH

📋 TL;DR

A Regular Expression Denial of Service (ReDoS) vulnerability in lunary-ai/lunary version 1.2.10 allows attackers to send specially crafted requests that cause catastrophic backtracking in regular expressions, leading to excessive CPU consumption and application crashes. This affects all systems running the vulnerable version of the lunary application, potentially causing complete service disruption.

💻 Affected Systems

Products:
  • lunary-ai/lunary
Versions: Version 1.2.10 specifically
Operating Systems: All operating systems running the vulnerable application
Default Config Vulnerable: ⚠️ Yes
Notes: Any deployment of lunary version 1.2.10 is vulnerable regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete application crash and denial of service, rendering the lunary service completely unavailable until manual intervention and restart.

🟠

Likely Case

Severe performance degradation with extremely slow response times or temporary service unavailability during attack periods.

🟢

If Mitigated

Minimal impact with proper rate limiting, request validation, and updated regular expressions that prevent catastrophic backtracking.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

The vulnerability requires sending specially crafted requests to trigger the vulnerable regular expressions. Public details are available in the referenced bounty reports.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Fixed in commit 1e8a3d941ba5cfef2c478dd5bac4e4a4b4d67830 and later versions

Vendor Advisory: https://github.com/lunary-ai/lunary/commit/1e8a3d941ba5cfef2c478dd5bac4e4a4b4d67830

Restart Required: Yes

Instructions:

1. Update lunary to the latest version or specifically to a version containing commit 1e8a3d941ba5cfef2c478dd5bac4e4a4b4d67830. 2. Restart the lunary application service. 3. Verify the fix is applied by checking the version.

🔧 Temporary Workarounds

Rate Limiting Implementation

all

Implement strict rate limiting on all endpoints to prevent attackers from sending multiple malicious requests.

# Configure rate limiting in your web server or application firewall
# Example for nginx: limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;

Input Validation and Sanitization

all

Add input validation to reject suspicious patterns before they reach the vulnerable regular expressions.

# Implement input validation in your application code
# Example: validate input length and character patterns

🧯 If You Can't Patch

  • Implement Web Application Firewall (WAF) rules to block requests with suspicious patterns that could trigger ReDoS.
  • Deploy the application behind a reverse proxy with request timeout limits and connection limits.

🔍 How to Verify

Check if Vulnerable:

Check if running lunary version 1.2.10 by examining package version or checking the commit hash against the vulnerable version.

Check Version:

Check package.json or run: npm list lunary-ai/lunary (if installed via npm) or check the application's version endpoint if available.

Verify Fix Applied:

Verify the application is running a version containing commit 1e8a3d941ba5cfef2c478dd5bac4e4a4b4d67830 or later.

📡 Detection & Monitoring

Log Indicators:

  • Unusually long request processing times for specific endpoints
  • High CPU usage spikes correlated with specific request patterns
  • Application crash logs with stack traces involving regular expression processing

Network Indicators:

  • Multiple requests with similar patterns causing slow responses
  • Unusual request patterns containing complex strings designed to trigger regex backtracking

SIEM Query:

source="application.logs" AND (message="*timeout*" OR message="*CPU*" OR message="*regex*" OR message="*backtrack*") AND dest_app="lunary"

🔗 References

📤 Share & Export