The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
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-39983

CVE-2026-39983: basic-ftp Command Injection Vulnerability

CVE-2026-39983 is an FTP command injection flaw in basic-ftp for Node.js that allows attackers to inject commands via CRLF sequences in file paths. This article covers technical details, affected versions, and mitigations.

Published: April 9, 2026

CVE-2026-39983 Overview

CVE-2026-39983 is a command injection vulnerability in basic-ftp, a popular FTP client library for Node.js. Prior to version 5.2.1, the library fails to properly sanitize CRLF sequences (\r\n) in file path parameters passed to high-level path APIs such as cd(), remove(), rename(), uploadFrom(), downloadTo(), list(), and removeDir(). This allows attackers to inject arbitrary FTP commands by crafting malicious path strings.

The vulnerability stems from the library's protectWhitespace() helper function, which only handles leading spaces and returns other paths unchanged. Since FtpContext.send() writes the resulting command string directly to the control socket with \r\n appended, attacker-controlled path strings can effectively split one intended FTP command into multiple commands, enabling unauthorized operations on the FTP server.

Critical Impact

Attackers can inject arbitrary FTP commands through malicious file paths, potentially enabling unauthorized file operations, data exfiltration, or server compromise on connected FTP servers.

Affected Products

  • basic-ftp for Node.js versions prior to 5.2.1

Discovery Timeline

  • April 9, 2026 - CVE CVE-2026-39983 published to NVD
  • April 9, 2026 - Last updated in NVD database

Technical Details for CVE-2026-39983

Vulnerability Analysis

This vulnerability is classified as CWE-93 (Improper Neutralization of CRLF Sequences). The fundamental issue lies in how the basic-ftp library processes user-supplied file paths before sending them as FTP commands.

FTP protocols use CRLF sequences (\r\n) as command delimiters. When an application passes a path containing these characters to any of the vulnerable API methods, the library's insufficient sanitization allows the attacker's payload to be interpreted as additional FTP commands by the server.

The protectWhitespace() function was designed to handle edge cases with whitespace in paths but did not account for control characters that could be used to terminate commands prematurely and inject new ones. This oversight creates a classic injection pattern where trusted and untrusted data are concatenated without proper boundary enforcement.

Root Cause

The root cause is the inadequate input validation in the protectWhitespace() helper function. This function only checks for and handles leading spaces in file paths, leaving CRLF sequences (\r\n) and null bytes (\0) unchecked. When these unvalidated paths are passed to FtpContext.send(), which directly writes to the FTP control socket with an appended \r\n, the attacker-controlled path content can break out of the intended command context.

Attack Vector

An attacker can exploit this vulnerability by providing a malicious file path to any of the affected API methods. For example, a path like "file.txt\r\nDELE important.txt\r\n" passed to the cd() function would result in both the original CWD command and an unauthorized DELETE command being sent to the FTP server. This attack requires network access and the ability to influence file path parameters used by the vulnerable application.

The following patch demonstrates how the fix validates paths to reject control character injection:

typescript
      * a given path to fix that issue for most cases.
      */
     async protectWhitespace(path: string): Promise<string> {
+        // Reject CRLF injection attempts
+        if (/[\r\n\0]/.test(path)) {
+            throw new Error("Invalid path: Contains control characters");
+        }
         if (!path.startsWith(" ")) {
             return path
         }

Source: GitHub Commit Update

Detection Methods for CVE-2026-39983

Indicators of Compromise

  • Unusual FTP commands in server logs that appear concatenated or contain unexpected operations
  • FTP command sequences containing CRLF characters (\r\n) or null bytes within path parameters
  • Unexpected file deletions, transfers, or directory changes on FTP servers
  • Application error logs showing failed FTP operations following suspicious path inputs

Detection Strategies

  • Implement network traffic monitoring to detect FTP command injection patterns
  • Review application logs for file path inputs containing control characters
  • Audit dependencies using npm audit or similar tools to identify vulnerable versions of basic-ftp
  • Deploy runtime application self-protection (RASP) solutions that can detect command injection attempts

Monitoring Recommendations

  • Enable detailed FTP server logging and monitor for anomalous command sequences
  • Set up alerts for FTP operations occurring outside normal business processes
  • Monitor Node.js application logs for errors related to invalid path characters
  • Implement file integrity monitoring on critical FTP server directories

How to Mitigate CVE-2026-39983

Immediate Actions Required

  • Upgrade basic-ftp to version 5.2.1 or later immediately
  • Audit applications using basic-ftp to identify exposure points where user-controlled input reaches file path APIs
  • Implement input validation to reject file paths containing CRLF sequences before passing them to basic-ftp
  • Review FTP server logs for signs of exploitation

Patch Information

The vulnerability is fixed in basic-ftp version 5.2.1. The fix adds validation in the protectWhitespace() function to reject paths containing carriage return (\r), line feed (\n), or null byte (\0) characters, throwing an error if these control characters are detected. The security patch is available in commit 2ecc8e2c500c5234115f06fd1dbde1aa03d70f4b.

For more information, see the GitHub Security Advisory GHSA-chqc-8p9q-pq6q and the GitHub Release v5.2.1.

Workarounds

  • Implement application-level input validation to strip or reject paths containing \r, \n, or \0 characters
  • Use allowlisting for permitted characters in file path inputs
  • Deploy web application firewalls (WAF) to filter requests containing control characters in path parameters
  • Isolate FTP operations to dedicated service accounts with minimal privileges
bash
# Configuration example
# Update basic-ftp to the patched version
npm update basic-ftp@5.2.1

# Or explicitly install the fixed version
npm install basic-ftp@5.2.1 --save

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

  • Vulnerability Details
  • TypeOther

  • Vendor/TechBasic Ftp

  • SeverityHIGH

  • CVSS Score8.6

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • CWE-93
  • Technical References
  • GitHub Commit Update

  • GitHub Release v5.2.1

  • GitHub Security Advisory GHSA-chqc-8p9q-pq6q
  • Latest CVEs
  • CVE-2026-40322: SiYuan Knowledge Management RCE Vulnerability

  • CVE-2026-40318: SiYuan Path Traversal Vulnerability

  • CVE-2026-40259: SiYuan Auth Bypass Vulnerability

  • CVE-2026-40255: AdonisJS HTTP Server CSRF 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