CVE-2023-27534: Path Traversal
A path traversal vulnerability exists in curl <8.0.0 SFTP implementation causes the tilde (~) character to be wrongly replaced when used as a prefix in the first path element in addition to its intended use as the first element to indicate a path relative to the user's home directory. Attackers can exploit this flaw to bypass filtering or execute arbitrary code by crafting a path like /~2/foo while accessing a server with a specific user.
Other sources
A path traversal vulnerability exists in curl <8.0.0 SFTP implementation causes the tilde (~) character to be wrongly replaced when used as a prefix in the first path element, in addition to its intended use as the first element to indicate a path relative to the user's home directory. Attackers can exploit this flaw to bypass filtering or execute arbitrary code by crafting a path like /~2/foo while accessing a server with a specific user.
cURL libcurl could allow a remote attacker to obtain sensitive information, caused by a SFTP path ~ resolving discrepancy flaw. By sending a specially crafted request using a tilde (~) character, an attacker could exploit this vulnerability to obtain sensitive information from other directory, and use this information to launch further attacks against the affected system.
— IBM
curl supports SFTP transfers. curl's SFTP implementation offers a special feature in the path component of URLs: a tilde (~) character as the first path element in the path to denotes a path relative to the user's home directory. This is supported because of wording in the once proposed to-become RFC draft that was to dictate how SFTP URLs work. Due to a bug, the handling of the tilde in SFTP path did however not only replace it when it is used stand-alone as the first path element but also wrongly when used as a mere prefix in the first element. Using a path like /~2/foo when accessing a server using the user dan (with home directory /home/dan) would then quite suprisingly access the file /home/dan2/foo. This can be taken advantage of to circumvent filtering or worse.
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/curlto a version that resolves this vulnerability.Fixed in 8.0.0
Event History
Frequently Asked Questions
What is the severity of CVE-2023-27534?
The severity of CVE-2023-27534 is high with a severity value of 8.8.
How does the path traversal vulnerability in CVE-2023-27534 impact curl <8.0.0 SFTP implementation?
The path traversal vulnerability in CVE-2023-27534 allows attackers to wrongly replace the tilde (~) character when used as a prefix in the first path element, causing potential unauthorized access to files outside the intended directory.
Which software versions are affected by CVE-2023-27534?
The curl versions prior to 8.0.0 and between 7.18.0 and 7.88.1 are affected by CVE-2023-27534.
How can I fix the path traversal vulnerability in curl <8.0.0?
To fix the path traversal vulnerability in curl <8.0.0, you should update curl to version 8.0.0 or higher.
Where can I find more information about CVE-2023-27534?
You can find more information about CVE-2023-27534 in the provided references: [link1](https://datatracker.ietf.org/doc/html/draft-ietf-secsh-scp-sftp-ssh-uri-04), [link2](https://bugzilla.redhat.com/show_bug.cgi/show_bug.cgi?id=2180434), [link3](https://bugzilla.redhat.com/show_bug.cgi/show_bug.cgi?id=2180436).