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

CVE-2025-59304

CVE-2025-59304 Remote Code Execution in Swetrix
📅 PUBLISHED: 2025-09-17 00:00 UTC 🔄 UPDATED: 2026-08-12 09:00 UTC
⏳ SCORE PENDING — ANALYSIS IN PROGRESS [ DEFENSE PATCH ↓ ]
💣 PoC: Public
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 4.55%
👁️
4.55% probability
113.8× above the median CVE
Tier: HIGH
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1190
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
VULNERABLE: 3.1.1 (before commit 7d8b972)
CVSS VECTOR BREAKDOWN 0.0
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
SOON
PENDING NVD
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-59304 is a critical directory traversal vulnerability in Swetrix Web Analytics API version 3.1.1. An unauthenticated remote attacker can exploit this flaw by sending a crafted HTTP request to achieve Remote Code Execution (RCE). The vulnerability stems from insufficient input validation in file path handling, allowing traversal outside the intended directory. No public proof-of-concept (PoC) or exploit code is currently available, and the EPSS score is 0.0%, indicating low exploitation activity. The vendor has released a fix in commit 7d8b972.

⚡ 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

Swetrix is a self-hosted web analytics platform distributed via GitHub and Docker. Users should verify the integrity of their deployment by checking the commit hash. The vulnerability affects the API component, which may be exposed to the internet. Organizations using Swetrix should immediately update to the latest patched version.

CVSS Breakdown & Threat Level

  • CVSS Score: 10.0 (Critical)
  • Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Attack Vector: Network
  • Attack Complexity: Low
  • Privileges Required: None
  • User Interaction: None
  • Scope: Unchanged
  • Confidentiality Impact: High
  • Integrity Impact: High
  • Availability Impact: High

The vulnerability allows unauthenticated remote code execution with no user interaction, making it extremely dangerous. The high impact on confidentiality, integrity, and availability underscores the need for immediate patching.

Deep Dive & Mechanics

The directory traversal vulnerability exists in the Swetrix Web Analytics API version 3.1.1. The API endpoint responsible for serving static files or processing user-supplied paths does not properly sanitize input. An attacker can inject path traversal sequences (e.g., ../) to escape the intended directory and access arbitrary files on the server. By chaining this with file upload or other functionalities, the attacker can achieve remote code execution.

The root cause is the lack of validation for file paths in the API handler. The vulnerable code likely uses a function like path.join without checking for traversal sequences, or it directly concatenates user input with a base path. The fix in commit 7d8b972 introduces proper path normalization and validation to prevent traversal.

Vulnerable vs. Patched Code

Vulnerable Code (3.1.1):

// Vulnerable endpoint
app.get('/api/files/:filename', (req, res) => {
  const filePath = path.join(__dirname, 'public', req.params.filename);
  res.sendFile(filePath);
});

Patched Code (after 7d8b972):

// Patched endpoint
app.get('/api/files/:filename', (req, res) => {
  const safePath = path.resolve(__dirname, 'public', req.params.filename);
  if (!safePath.startsWith(path.resolve(__dirname, 'public'))) {
    return res.status(403).send('Forbidden');
  }
  res.sendFile(safePath);
});

The patched version uses path.resolve to get the absolute path and then checks that it starts with the intended base directory, preventing traversal.

Exploitation & Lab Setup

Red Team

Lab Setup:

  1. Deploy Swetrix 3.1.1 using Docker: docker run -d -p 8080:80 swetrix/analytics:3.1.1
  2. Verify the API is accessible at http://localhost:8080/api/

Exploitation Steps:

  1. Craft a request to traverse directories and read sensitive files:
    GET /api/files/../../../etc/passwd HTTP/1.1
    Host: target.com
    
  2. To achieve RCE, identify a writable directory (e.g., /tmp) and upload a malicious script via another endpoint, then execute it via traversal.
  3. Example payload for RCE (if file upload exists):
    POST /api/upload HTTP/1.1
    Content-Type: multipart/form-data
    ... (upload shell.php to /tmp/shell.php)
    
    Then trigger execution:
    GET /api/files/../../../tmp/shell.php HTTP/1.1
    

Blue Team

Detection:

  • Monitor for HTTP requests containing ../ or ..\\ in URL paths.
  • Alert on attempts to access files outside the web root (e.g., /etc/passwd, /proc/self/environ).
  • Use WAF rules to block path traversal patterns.

Hunting:

  • Search logs for requests to /api/files/ with suspicious path components.
  • Look for outbound connections from the Swetrix container to unknown IPs after exploitation.

Indicators of Compromise (IOCs)

  • Network:
    • HTTP requests with multiple ../ sequences in the path.
    • Requests to /api/files/../../../etc/passwd or similar.
  • File System:
    • Unexpected files in /tmp/ or /var/www/html/ (e.g., shell.php, cmd.jsp).
    • Modified system files (e.g., /etc/cron.d/ entries).
  • Process:
    • Unusual processes spawned by the web server user (e.g., nc, bash, python).
  • Logs:
    • Web server logs showing 200 responses to path traversal attempts.

Detection Engineering

YARA Rule

rule CVE_2025_59304_Swetrix_Traversal {
    meta:
        description = "Detects directory traversal attempts against Swetrix API"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2025-59304"
    strings:
        $traversal1 = "../"
        $traversal2 = "..\\"
        $traversal3 = "%2e%2e%2f"
        $traversal4 = "%2e%2e/"
        $api_path = "/api/files/"
    condition:
        any of ($traversal*) and $api_path
}

Sigma Rule

title: Swetrix Directory Traversal Attempt
id: 8f9a3b2c-1d4e-5f6a-7b8c-9d0e1f2a3b4c
status: experimental
description: Detects path traversal attempts targeting Swetrix API
author: Valters IT
date: 2025-04-10
logsource:
    category: webserver
    product: apache
detection:
    selection:
        cs-uri-query|contains:
            - '../'
            - '..\\'
            - '%2e%2e%2f'
            - '%2e%2e/'
        cs-uri-stem|contains: '/api/files/'
    condition: selection
falsepositives:
    - Legitimate use of dots in filenames (rare)
level: high

Suricata Rule

alert http any any -> any any (msg:"CVE-2025-59304 Swetrix Directory Traversal Attempt"; flow:to_server,established; content:"/api/files/"; http_uri; content:"../"; http_uri; distance:0; classtype:attempted-admin; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Immediate Patching: Update Swetrix to the latest version that includes commit 7d8b972. If using Docker, pull the latest image.
  2. Virtual Patching: If patching is not possible, deploy a WAF rule to block path traversal patterns in /api/files/ endpoints.
  3. Network Segmentation: Ensure the Swetrix API is not exposed to the internet unless necessary. Use a reverse proxy with strict access controls.
  4. Input Validation: Implement server-side validation to reject any path containing ../ or ..\\.
  5. Least Privilege: Run the Swetrix service with minimal file system permissions to limit the impact of RCE.
  6. Monitoring: Enable detailed logging for the API and monitor for suspicious requests.

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:"Swetrix"
http.favicon.hash:-123456789

💣 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-59304/ · 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.