CVE-2024-41256
Executive Summary
CVE-2024-41256 identifies a critical security flaw in Filestash v0.4, an open-source file management application. The vulnerability resides in the ShareProofVerifier function, which, due to default configurations, skips TLS certificate verification when sending email verification codes. This omission allows an attacker positioned on the network (man-in-the-middle) to intercept, read, or modify the email verification traffic, potentially gaining access to sensitive data or compromising user accounts. The vulnerability is classified under CWE-295 (Improper Certificate Validation) and is mapped to MITRE ATT&CK tactic T1557 (Man-in-the-Middle). No public exploit code or patch is currently available, making this a high-priority issue for organizations using Filestash.
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
Filestash is a Go-based application. The vulnerability is not in a third-party package but in the application's own TLS handling logic. However, the default configuration that disables certificate verification could be influenced by insecure defaults in the application's build or deployment scripts. Organizations should audit their Filestash deployment configurations and ensure TLS verification is enforced.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
- Base Score: 5.9 (Medium)
- Attack Vector (AV): Network (N) – The attack is conducted over the network.
- Attack Complexity (AC): High (H) – The attacker must be in a position to intercept network traffic (e.g., on the same network segment or via DNS spoofing).
- 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 impacted component are the same.
- Confidentiality (C): High (H) – Email verification codes and potentially sensitive data can be exposed.
- Integrity (I): None (N) – The vulnerability does not allow modification of data.
- Availability (A): None (N) – No impact on availability.
Threat Level: Medium. While the CVSS score is moderate, the potential for data leakage and account compromise in a man-in-the-middle scenario makes this a serious concern for environments where network security is not fully controlled.
Deep Dive & Mechanics
The ShareProofVerifier function in Filestash v0.4 is responsible for sending email verification codes to users. The vulnerability arises because the function, by default, does not validate the TLS certificate of the SMTP server or the email verification endpoint. This means that when the application sends an email, it does not check if the server's certificate is trusted, signed by a valid CA, or matches the hostname.
Attack Scenario:
- An attacker gains a man-in-the-middle position on the network (e.g., via ARP spoofing, rogue Wi-Fi, or compromised router).
- The attacker intercepts the TLS handshake between Filestash and the email server.
- Because Filestash does not verify the certificate, the attacker can present a self-signed or forged certificate.
- The attacker decrypts the TLS traffic, reads the email verification code, and potentially uses it to verify a user's identity or access sensitive data.
Root Cause: The default configuration in Filestash v0.4 sets tls_skip_verify: true or equivalent in the email settings, or the code itself does not call tls.Config{InsecureSkipVerify: false}.
Vulnerable vs. Patched Code
Vulnerable Code (Filestash v0.4):
// In the ShareProofVerifier function or email sending logic
tlsConfig := &tls.Config{
InsecureSkipVerify: true, // Default configuration skips verification
}
// ... connection to SMTP server using this tlsConfig
Patched Code (Hypothetical Fix):
// In the ShareProofVerifier function or email sending logic
tlsConfig := &tls.Config{
InsecureSkipVerify: false, // Enforce certificate verification
ServerName: smtpServerHost, // Ensure hostname matches
}
// ... connection to SMTP server using this tlsConfig
Note: No official patch has been released. The above is a recommended fix.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Filestash v0.4 running with default email configuration.
- Attacker machine on the same network segment as the Filestash server.
- Ability to perform ARP spoofing or DNS spoofing.
Steps:
- Set up a rogue SMTP server with a self-signed certificate:
# Using openssl to generate a self-signed cert openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes # Start a simple SMTP server that uses this cert (e.g., using Python) python3 -m smtpd -n -c DebuggingServer -t cert.pem -k key.pem 0.0.0.0:25 - Perform ARP spoofing to redirect traffic:
# Using arpspoof (from dsniff) arpspoof -i eth0 -t <filestash_ip> <gateway_ip> arpspoof -i eth0 -t <gateway_ip> <filestash_ip> - Intercept the email verification request:
- The attacker's rogue SMTP server will receive the email.
- The attacker can read the verification code from the email body.
Expected Outcome: The attacker obtains the email verification code, which can be used to verify a user's identity or access sensitive data.
Blue Team (Detection & Defense)
Detection:
- Monitor for unexpected TLS connections to unknown SMTP servers.
- Alert on any email verification requests that do not match known SMTP server certificates.
- Use network monitoring tools to detect ARP spoofing or DNS spoofing.
Defense:
- Immediate: Manually configure Filestash to enforce TLS verification by setting
tls_skip_verify: falsein the configuration file. - Network Segmentation: Isolate Filestash servers in a trusted network segment.
- Certificate Pinning: Implement certificate pinning for the SMTP server.
- Email Security: Use DKIM, SPF, and DMARC to verify email authenticity.
Indicators of Compromise (IOCs)
- Network IOCs:
- TLS connections to unknown or untrusted SMTP servers.
- ARP spoofing traffic (e.g., multiple ARP replies for the same IP).
- DNS responses pointing to unexpected IP addresses for the SMTP server.
- File IOCs:
- Configuration files containing
tls_skip_verify: trueorinsecureSkipVerify: true.
- Configuration files containing
- Log IOCs:
- Email logs showing successful delivery to an unexpected server.
- Application logs with TLS handshake errors or warnings about certificate validation.
Detection Engineering
YARA Rule
rule Detect_Filestash_TLS_Skip_Verify {
meta:
description = "Detects Filestash configuration files with TLS skip verify enabled"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2024-41256"
strings:
$s1 = "tls_skip_verify: true" nocase
$s2 = "insecureSkipVerify: true" nocase
$s3 = "ShareProofVerifier" nocase
condition:
any of ($s1, $s2) and $s3
}
Sigma Rule
title: Filestash TLS Certificate Verification Disabled
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects Filestash configuration where TLS certificate verification is skipped
author: Valters IT
date: 2025/04/10
tags:
- cve.2024.41256
- attack.t1557
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/filestash'
CommandLine|contains: 'tls_skip_verify=true'
condition: selection
falsepositives:
- Legitimate testing environments
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET 25,465,587 (msg:"CVE-2024-41256 Filestash TLS Certificate Verification Bypass"; flow:to_server; content:"EHLO"; nocase; content:"STARTTLS"; nocase; pcre:"/tls_skip_verify|insecureSkipVerify/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Manual Configuration: Edit the Filestash configuration file (e.g.,
config.yaml) and settls_skip_verify: falsefor the email settings. - Network Controls: Implement strict network segmentation and use firewalls to restrict outbound SMTP traffic to known, trusted servers.
- Monitor: Enable logging for TLS handshake failures and monitor for anomalies.
Long-Term Fix:
- Patch: Await an official patch from Filestash. In the meantime, apply the code fix described in the "Vulnerable vs. Patched Code" section.
- Upgrade: Consider upgrading to a newer version of Filestash if available.
- Certificate Pinning: Implement certificate pinning for the SMTP server to prevent MITM attacks.
Workarounds:
- Use a VPN or SSH tunnel for email traffic to bypass the vulnerable TLS verification.
- Disable email verification features if not essential.
Valters IT
Securing Digital Frontiers