CVE-2024-6862
📋 TL;DR
This CSRF vulnerability in lunary-ai/lunary version 1.2.34 allows attackers to perform unauthorized actions like creating projects by exploiting overly permissive CORS settings. It primarily affects locally hosted instances on personal machines that aren't publicly accessible. Attackers can abuse unauthenticated endpoints to act as legitimate users.
💻 Affected Systems
- lunary-ai/lunary
📦 What is this software?
Lunary by Lunary
⚠️ Risk & Real-World Impact
Worst Case
Complete compromise of the lunary instance where attackers create malicious projects, manipulate data, or abuse system resources as authenticated users.
Likely Case
Unauthorized project creation and resource consumption by attackers who trick users into visiting malicious websites while their lunary instance is running locally.
If Mitigated
Minimal impact if proper CORS restrictions and CSRF protections are implemented, limiting requests to trusted origins only.
🎯 Exploit Status
Exploitation requires tricking a user with an active lunary session into visiting a malicious website. No authentication needed for vulnerable endpoints.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Fixed in commit 3451fcd7b9d95e9091d62c515752f39f2faa6e54
Vendor Advisory: https://github.com/lunary-ai/lunary/commit/3451fcd7b9d95e9091d62c515752f39f2faa6e54
Restart Required: Yes
Instructions:
1. Update lunary to the latest version. 2. Apply the commit that restricts CORS origins. 3. Restart the lunary service.
🔧 Temporary Workarounds
Restrict CORS Origins
allManually configure CORS to only allow trusted origins instead of all origins.
Edit CORS configuration in lunary backend to specify allowed origins
Implement CSRF Tokens
allAdd CSRF token validation to all endpoints, especially unauthenticated ones.
Implement CSRF middleware and token validation in application code
🧯 If You Can't Patch
- Isolate the lunary instance on a separate network segment with no internet access
- Use browser extensions that block cross-origin requests to the lunary instance
🔍 How to Verify
Check if Vulnerable:
Check if CORS headers allow '*' or all origins in response headers. Test if unauthenticated endpoints accept cross-origin requests.
Check Version:
Check lunary version in package.json or via application interface
Verify Fix Applied:
Verify CORS headers now specify allowed origins and cross-origin requests to unauthenticated endpoints are blocked.
📡 Detection & Monitoring
Log Indicators:
- Unusual project creation events from unexpected origins
- Multiple failed CORS validation attempts
Network Indicators:
- Cross-origin requests to lunary endpoints from untrusted domains
- CSRF attack patterns in web traffic
SIEM Query:
source=lunary AND (event="project_created" OR event="user_action") AND origin NOT IN ["trusted_domains"]