Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-40876

CVE-2026-40876: goshs SFTP Path Traversal Vulnerability

CVE-2026-40876 is a path traversal flaw in goshs SFTP server that allows authenticated users to escape the configured root directory and access arbitrary files. This article covers technical details, affected versions, and patches.

Published: April 23, 2026

CVE-2026-40876 Overview

CVE-2026-40876 is a path traversal vulnerability in goshs, a SimpleHTTPServer written in Go. Prior to version 2.0.0-beta.6, goshs contains an SFTP root escape caused by prefix-based path validation. An authenticated SFTP user can read from and write to filesystem paths outside the configured SFTP root, which breaks the intended jail boundary and can expose or modify unrelated server files.

Critical Impact

Authenticated attackers can escape the SFTP jail boundary to read sensitive files or write malicious content anywhere on the filesystem accessible to the goshs process, potentially leading to unauthorized data access, data tampering, or server compromise.

Affected Products

  • goshs versions prior to 2.0.0-beta.6

Discovery Timeline

  • 2026-04-21 - CVE-2026-40876 published to NVD
  • 2026-04-22 - Last updated in NVD database

Technical Details for CVE-2026-40876

Vulnerability Analysis

This path traversal vulnerability stems from an insecure path validation mechanism in the goshs SFTP subsystem. The SFTP subsystem routes requests through sftpserver/sftpserver.go into DefaultHandler.GetHandler() in sftpserver/handler.go, which forwards file operations into the readFile, writeFile, listFile, and cmdFile functions. All of these sinks rely on sanitizePath() in sftpserver/helper.go for path validation.

The vulnerability is classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), commonly known as Path Traversal or Directory Traversal.

Root Cause

The root cause lies in the sanitizePath() function within sftpserver/helper.go. This function uses a raw string-prefix comparison rather than a proper directory-boundary check. Because of this flawed approach, if the configured SFTP root is /tmp/goshsroot, then a sibling path such as /tmp/goshsroot_evil/secret.txt incorrectly passes validation since it starts with the same byte prefix.

This prefix-based validation fails to properly verify that paths resolve to actual subdirectories of the intended root, allowing attackers to construct paths that share the same prefix but reference locations outside the jail.

Attack Vector

The attack requires network access and low-privilege authentication to the SFTP service. Once authenticated, an attacker can craft specially constructed file paths that share the same prefix as the configured SFTP root but actually reference sibling directories or files outside the intended boundary.

For example, if the SFTP root is configured as /tmp/goshsroot, an attacker could request files from /tmp/goshsroot_evil/ or /tmp/goshsrootanything/ since these paths begin with the same string prefix as the legitimate root. This allows reading arbitrary files from or writing malicious content to any filesystem location accessible to the goshs process.

The vulnerability mechanism is described in the GitHub Security Advisory with full technical details.

Detection Methods for CVE-2026-40876

Indicators of Compromise

  • SFTP access logs showing requests to paths with the SFTP root prefix followed by unexpected characters (e.g., underscores, additional path components)
  • File access or modification events on directories sibling to the configured SFTP root
  • Unauthorized read access to sensitive system files such as /etc/passwd or configuration files
  • Unexpected file writes in directories adjacent to the SFTP root directory

Detection Strategies

  • Monitor SFTP session logs for path access patterns that share the root prefix but deviate from expected subdirectory structure
  • Implement file integrity monitoring on critical system files and directories adjacent to SFTP root paths
  • Analyze goshs process file access using system auditing tools to detect reads/writes outside the intended root

Monitoring Recommendations

  • Enable verbose logging in goshs to capture full SFTP request paths
  • Configure host-based intrusion detection systems (HIDS) to alert on file access patterns consistent with path traversal attempts
  • Review goshs SFTP root configurations to identify instances where sibling paths with similar prefixes could be exploited

How to Mitigate CVE-2026-40876

Immediate Actions Required

  • Upgrade goshs to version 2.0.0-beta.6 or later immediately
  • Audit SFTP access logs for any historical exploitation attempts using prefix-based path escape
  • Review file system permissions to ensure the goshs process runs with minimal required privileges
  • Consider temporarily disabling SFTP functionality until the upgrade is complete

Patch Information

This vulnerability is fixed in goshs version 2.0.0-beta.6. The fix implements proper directory-boundary checking in the sanitizePath() function rather than relying on string-prefix comparison. Users should upgrade to this version or later to remediate the vulnerability.

For detailed patch information, refer to the GitHub Security Advisory.

Workarounds

  • Configure the SFTP root path to a unique directory name that is unlikely to have sibling directories with similar prefixes
  • Run goshs in a containerized or sandboxed environment to limit filesystem access even if the jail is escaped
  • Apply operating system-level access controls (chroot, AppArmor, SELinux) to restrict the goshs process filesystem access
  • Implement network segmentation to limit which users can authenticate to the SFTP service
bash
# Example: Run goshs with restrictive filesystem access using Docker
docker run --read-only \
  -v /path/to/sftp/root:/sftp:rw \
  --security-opt no-new-privileges \
  goshs:2.0.0-beta.6

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypePath Traversal

  • Vendor/TechGoshs

  • SeverityHIGH

  • CVSS Score8.7

  • EPSS Probability0.04%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-22
  • Technical References
  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-40188: Goshs Path Traversal Vulnerability

  • CVE-2026-35471: Goshs Path Traversal Vulnerability

  • CVE-2026-35393: Goshs Path Traversal Vulnerability

  • CVE-2026-35392: Goshs Path Traversal Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English