CVE-2020-26299: Ftp srv File System Bounds Escape Vulnerability
MODERATECVE-2020-26299 is a MODERATE file system bounds escape vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Ftp srv libraries in the npm ecosystem. The issue involves file system bounds escape. Remediation is available by upgrading affected packages to version 4.4.0.
CVE-2020-26299 at a Glance
How to Fix CVE-2020-26299
To remediate this vulnerability, upgrade all affected Ftp srv dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install ftp-srv@4.4.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls ftp-srv
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2020-26299, inspect your project dependencies using npm:
npm ls ftp-srv
Analyze the terminal output to locate any version of Ftp srv in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.4.0), your application is affected.
Note: The npm ls ftp-srv command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Ftp srv, 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
CVE-2020-26299 Affected Ftp srv Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ftp-srv
|
npm |
< 4.4.0
|
4.4.0
|
References
Frequently Asked Questions
What is CVE-2020-26299?
Which Ftp srv versions are affected?
What version fixes CVE-2020-26299?
Is ftp-srv affected?
What CWE is associated with CVE-2020-26299?
How can I check npm dependencies for CVE-2020-26299?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pmw4-jgxx-pcq9",
"modified" : "2021-02-11T17:04:52Z",
"published" : "2021-02-10T18:11:34Z",
"aliases" : [ "CVE-2020-26299" ],
"summary" : "File System Bounds Escape",
"details" : "### Impact\n\nClients of FTP servers utilizing `ftp-srv` hosted on Windows machines can escape the FTP user's defined root folder using the expected FTP commands, for example, `CWD` and `UPDR`.\n\n### Background\n\nWhen windows separators exist within the path (`\\`), `path.resolve` leaves the upper pointers intact and allows the user to move beyond the root folder defined for that user. We did not take that into account when creating the path resolve function.\n\n\n\n### Patches\nNone at the moment.\n\n### Workarounds\nThere are no workarounds for windows servers. Hosting the server on a different OS mitigates the issue.\n\n### References\n\nIssues: \nhttps://github.com/autovance/ftp-srv/issues/167\nhttps://github.com/autovance/ftp-srv/issues/225\n\n### For more information\nIf you have any questions or comments about this advisory:\nOpen an issue at https://github.com/autovance/ftp-srv.\nPlease email us directly; security@autovance.com.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "ftp-srv"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.4.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/autovance/ftp-srv/security/advisories/GHSA-pmw4-jgxx-pcq9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-26299"
}, {
"type" : "WEB",
"url" : "https://github.com/autovance/ftp-srv/issues/167"
}, {
"type" : "WEB",
"url" : "https://github.com/autovance/ftp-srv/issues/225"
}, {
"type" : "WEB",
"url" : "https://github.com/autovance/ftp-srv/pull/224"
}, {
"type" : "WEB",
"url" : "https://github.com/autovance/ftp-srv/commit/457b859450a37cba10ff3c431eb4aa67771122e3"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/ftp-srv"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-02-10T18:11:21Z",
"nvd_published_at" : "2021-02-10T18:15:00Z"
}
}