CVE-2025-24366: Github.com/drakkan/sftpgo/v2 SFTPGo Has Insufficient Sanitization Of Vulnerability

HIGH
Advisory Identifier: GHSA-vj7w-3m8c-6vpx
CVSS 7.5
CWE-78
Published
Advisory Summary

CVE-2025-24366 is a HIGH (CVSS 7.5) sftpgo has insufficient sanitization of vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Github.com/drakkan/sftpgo/v2 libraries in the Go ecosystem. The issue involves sftpgo has insufficient sanitization of user provided rsync command. Remediation is available by upgrading affected packages to version 2.6.5.

CVE-2025-24366 at a Glance

CVE Identifier CVE-2025-24366
GHSA Identifier GHSA-vj7w-3m8c-6vpx
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Github.com/drakkan/sftpgo/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2025-24366

To remediate this vulnerability, upgrade all affected Github.com/drakkan/sftpgo/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/drakkan/sftpgo/v2 fixed: 2.6.5
Upgrade github.com/drakkan/sftpgo/v2 to 2.6.5
github.com/drakkan/sftpgo fixed: Latest secure release
Upgrade github.com/drakkan/sftpgo to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/drakkan/sftpgo/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-24366, inspect your project dependencies for Github.com/drakkan/sftpgo/v2:

inspect dependencies for github.com/drakkan/sftpgo/v2

Analyze the terminal output to locate any version of Github.com/drakkan/sftpgo/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6.5), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Github.com/drakkan/sftpgo/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact SFTPGo supports execution of a defined set of commands via SSH. Besides a set of default commands some optional commands can be activated, one of them being `rsync`: it is disabled in the default configuration and it is limited to the local filesystem, it does not work with cloud/remote storage backends. Due to missing sanitization of the client provided `rsync` command, an authenticated remote user can use some options of the rsync command to read or write files with the permissions of the SFTPGo server process. ### Patches This issue was fixed in version v2.6.5 by checking the client provided arguments. https://github.com/drakkan/sftpgo/commit/b347ab6051f6c501da205c09315fe99cd1fa3ba1

CVE-2025-24366 Affected Github.com/drakkan/sftpgo/v2 Versions

2 component(s)
Fixed Versions:
2.6.5
Product / Package Ecosystem Affected Versions Fixed Version
github.com/drakkan/sftpgo/v2
Go
≥ 0.9.5
< 2.6.5
2.6.5
github.com/drakkan/sftpgo
Go
≤ 1.2.2

References

Frequently Asked Questions

What is CVE-2025-24366?
CVE-2025-24366 is a security vulnerability in Github.com/drakkan/sftpgo/v2 involving SFTPGo has insufficient sanitization of user provided rsync command under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Github.com/drakkan/sftpgo/v2 versions are affected?
Affected versions include releases prior to 2.6.5 across affected packages: github.com/drakkan/sftpgo/v2, github.com/drakkan/sftpgo.
What version fixes CVE-2025-24366?
Upgrading to 2.6.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/drakkan/sftpgo/v2 affected?
Yes, github.com/drakkan/sftpgo/v2 is affected in releases prior to 2.6.5. Upgrade your dependency to 2.6.5 or later.
Is github.com/drakkan/sftpgo affected?
Yes, github.com/drakkan/sftpgo is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2025-24366?
CVE-2025-24366 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2025-24366?
CVE-2025-24366 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2025-24366?
Run the dependency tree command: 'inspect dependencies for github.com/drakkan/sftpgo/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vj7w-3m8c-6vpx",
  "modified" : "2025-02-10T17:01:46Z",
  "published" : "2025-02-07T20:31:22Z",
  "aliases" : [ "CVE-2025-24366" ],
  "summary" : "SFTPGo has insufficient sanitization of user provided rsync command",
  "details" : "### Impact\nSFTPGo supports execution of a defined set of commands via SSH. Besides a set of default commands some optional commands can be activated, one of them being `rsync`: it is disabled in the default configuration and it is limited to the local filesystem, it does not work with cloud/remote storage backends.\n\nDue to missing sanitization of the client provided `rsync` command, an authenticated remote user can use some options of the rsync command to read or write files with the permissions of the SFTPGo server process. \n\n### Patches\nThis issue was fixed in version v2.6.5 by checking the client provided arguments.\n\nhttps://github.com/drakkan/sftpgo/commit/b347ab6051f6c501da205c09315fe99cd1fa3ba1",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/drakkan/sftpgo/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.9.5"
      }, {
        "fixed" : "2.6.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.6.4"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/drakkan/sftpgo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.2.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/drakkan/sftpgo/security/advisories/GHSA-vj7w-3m8c-6vpx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-24366"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/drakkan/sftpgo/commit/b347ab6051f6c501da205c09315fe99cd1fa3ba1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/drakkan/sftpgo"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-02-07T20:31:22Z",
    "nvd_published_at" : "2025-02-07T22:15:14Z"
  }
}