CVE-2023-37474: Copyparty Path Traversal Vulnerability
HIGHCVE-2023-37474 is a HIGH (CVSS 7.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Copyparty libraries in the PyPI ecosystem. The issue involves copyparty vulnerable to path traversal attack. Remediation is available by upgrading affected packages to version 1.8.2.
CVE-2023-37474 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2023-37474
To remediate this vulnerability, upgrade all affected Copyparty dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install copyparty>=1.8.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show copyparty
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2023-37474, inspect your installed packages using pip:
pip show copyparty
Analyze the terminal output to locate any version of Copyparty in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.8.2), your application is affected.
Note: The pip show copyparty command checks currently installed packages in your active Python environment.
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 Copyparty, 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-2023-37474 Affected Copyparty Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
copyparty
|
PyPI |
< 1.8.2
|
1.8.2
|
References
Frequently Asked Questions
What is CVE-2023-37474?
Which Copyparty versions are affected?
What version fixes CVE-2023-37474?
Is copyparty affected?
What is the CVSS score of CVE-2023-37474?
What CWE is associated with CVE-2023-37474?
How can I check PyPI dependencies for CVE-2023-37474?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pxfv-7rr3-2qjg",
"modified" : "2024-09-13T18:19:54Z",
"published" : "2023-07-14T21:59:23Z",
"aliases" : [ "CVE-2023-37474" ],
"summary" : "copyparty vulnerable to path traversal attack",
"details" : "# Summary\nAll versions before 1.8.2 have a path traversal vulnerability, allowing an attacker to download unintended files from the server.\n\n# Details\nUnauthenticated users were able to retrieve any files which are accessible (according to OS-level permissions) from the copyparty process. Usually, this is all files that are readable by the OS account which is used to run copyparty.\n\nThe vulnerability did not make it possible to list the contents of folders, so an attacker needs to know the full absolute path to the file, or the relative path from where copyparty is installed.\n\nSome methods of running copyparty ([prisonparty](https://github.com/9001/copyparty/tree/hovudstraum/bin#prisonpartysh), the [nix package](https://github.com/9001/copyparty#nix-package), and [docker](https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker)) had a mitigating effect, mostly reducing the attack scope to files inside copyparty volumes, and possibly the copyparty config file.\n\n# Checking for attacks\nPlease keep in mind that, if an attacker were to find a way to overwrite the logs, for example by discovering the password to another service with sufficient privileges, then the following approaches cannot be trusted.\n\nif copyparty was only accessible through a reverse proxy, then all attacks would be visible in the webserver access-log as URLs which contain both `.cpr/` and `%2F`\n* nginx:\n ```bash\n (gzip -dc access.log*.gz; cat access.log) | sed -r 's/\" [0-9]+ .*//' | grep -E 'cpr/.*%2[^0]' | grep -vF data:image/svg\n ```\n\nHowever, if copyparty was directly accessible from the internet, then any successful attacks (file retrievals) would unfortunately leave no trace. That said, it is very probable that an attacker would make at least one invalid attempt, which would become apparent in the copyparty server log, detectable with `grep -aE '(Errno|Permission).*\\.cpr/'` revealing the following:\n* python2 example: `[IOError] [Errno 13] Permission denied: '/etc/shadow', .cpr//etc/shadow`\n* python3 example: `[PermissionError] [Errno 13] Permission denied: b'/etc/shadow', .cpr//etc/shadow`\n \n\nProviding an exact command for this approach is difficult, as it depends on how copyparty is deployed;\n* if copyparty was running as a systemd service: `journalctl -am | grep -aE '(Errno|Permission).*\\.cpr/'`\n* if copyparty was logging to a compressed file: `xz -kdc thefilename.xz | grep -aE '(Errno|Permission).*\\.cpr/'`\n* if the copyparty log is available in a plaintext file: `grep -aE '(Errno|Permission).*\\.cpr/' thefilename.txt`\n\n# PoC / attack example\n```bash\ncurl -sik http://127.0.0.1:3923/.cpr/%2Fetc%2Fpasswd\ncurl -sik http://127.0.0.1:3923/.cpr/..%2F..%2F..%2F..%2F..%2Fetc%2Fpasswd\n```\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "copyparty"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.8.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/9001/copyparty/security/advisories/GHSA-pxfv-7rr3-2qjg"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-37474"
}, {
"type" : "WEB",
"url" : "https://github.com/9001/copyparty/commit/043e3c7dd683113e2b1c15cacb9c8e68f76513ff"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/9001/copyparty"
}, {
"type" : "WEB",
"url" : "https://github.com/9001/copyparty/releases/tag/v1.8.2"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/copyparty/PYSEC-2023-127.yaml"
}, {
"type" : "WEB",
"url" : "http://packetstormsecurity.com/files/173822/Copyparty-1.8.2-Directory-Traversal.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2023-07-14T21:59:23Z",
"nvd_published_at" : "2023-07-14T20:15:09Z"
}
}