CVE-2025-5352
CVE-2025-5352
Weakness (CWE)
CVSS Vector
v3.1- Attack Vector
- Network
- Attack Complexity
- Low
- Privileges Required
- None
- User Interaction
- Required
- Scope
- Changed
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Description
A critical stored Cross-Site Scripting (XSS) vulnerability exists in the Analytics component of lunary-ai/lunary versions up to 1.9.23, where the NEXT_PUBLIC_CUSTOM_SCRIPT environment variable is directly injected into the DOM using dangerouslySetInnerHTML without any sanitization or validation. This allows arbitrary JavaScript execution in all users' browsers if an attacker can control the environment variable during deployment or through server compromise. The vulnerability can lead to complete account takeover, data exfiltration, malware distribution, and persistent attacks affecting all users until the environment variable is cleaned. The issue is fixed in version 1.9.25.
Comprehensive Technical Analysis of CVE-2025-5352
1. Vulnerability Assessment and Severity Evaluation
CVE ID: CVE-2025-5352 CVSS Score: 9.6
The vulnerability is classified as a critical stored Cross-Site Scripting (XSS) issue in the Analytics component of lunary-ai/lunary. The severity is high due to the potential for arbitrary JavaScript execution, which can lead to complete account takeover, data exfiltration, malware distribution, and persistent attacks. The CVSS score of 9.6 reflects the critical nature of the vulnerability, indicating a high risk to affected systems.
2. Potential Attack Vectors and Exploitation Methods
Attack Vectors:
- Environment Variable Manipulation: An attacker could manipulate the
NEXT_PUBLIC_CUSTOM_SCRIPTenvironment variable during deployment or through server compromise. - Server Compromise: If an attacker gains access to the server, they can modify the environment variable to inject malicious scripts.
Exploitation Methods:
- Direct Injection: The attacker injects malicious JavaScript code into the
NEXT_PUBLIC_CUSTOM_SCRIPTenvironment variable. - Persistent XSS: The injected script persists in the DOM, affecting all users who interact with the compromised environment.
3. Affected Systems and Software Versions
Affected Software:
- lunary-ai/lunary versions up to 1.9.23
Fixed Version:
- The issue is resolved in version 1.9.25.
4. Recommended Mitigation Strategies
Immediate Actions:
- Upgrade to the Latest Version: Upgrade to lunary-ai/lunary version 1.9.25 or later to mitigate the vulnerability.
- Environment Variable Sanitization: Ensure that all environment variables are sanitized and validated before being used in the application.
Long-Term Strategies:
- Regular Security Audits: Conduct regular security audits and code reviews to identify and mitigate similar vulnerabilities.
- Input Validation: Implement robust input validation and sanitization mechanisms for all user inputs and environment variables.
- Content Security Policy (CSP): Implement a strong Content Security Policy to mitigate the impact of XSS attacks.
5. Impact on Cybersecurity Landscape
The discovery and exploitation of CVE-2025-5352 highlight the critical importance of securing environment variables and ensuring proper sanitization of inputs. This vulnerability underscores the need for continuous monitoring and updating of software dependencies to mitigate potential risks. The high CVSS score indicates the significant impact on the cybersecurity landscape, emphasizing the need for proactive security measures.
6. Technical Details for Security Professionals
Vulnerability Details:
- Component: Analytics component of lunary-ai/lunary
- Vulnerable Code: The
NEXT_PUBLIC_CUSTOM_SCRIPTenvironment variable is directly injected into the DOM usingdangerouslySetInnerHTMLwithout any sanitization or validation.
Exploitation Example:
// Malicious script injected into NEXT_PUBLIC_CUSTOM_SCRIPT
const maliciousScript = "<script>alert('XSS Attack');</script>";
// Injection into the DOM
dangerouslySetInnerHTML({ __html: maliciousScript });
Mitigation Code Example:
// Sanitize and validate the environment variable
const sanitizedScript = sanitizeInput(process.env.NEXT_PUBLIC_CUSTOM_SCRIPT);
// Safely inject into the DOM
dangerouslySetInnerHTML({ __html: sanitizedScript });
References:
By addressing this vulnerability promptly and implementing robust security practices, organizations can significantly reduce the risk of XSS attacks and enhance their overall cybersecurity posture.