CVE-2024-47049: czim/file-handling SSRF and Directory Traversal Vulnerability
Summary
CVE-2024-47049: czim/file-handling vulnerable to SSRF and directory traversal. Affects czim/file-handling across 2 version ranges.
< 1.5.0
>= 2.0.0, < 2.3.0
Fixed in 1.5.0 or 2.3.0, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The czim/file-handling package is a PHP library used for handling file operations, including reading and writing files from various sources. It is commonly utilized in applications that require file manipulation capabilities. However, prior to versions 1.5.0 and 2.3.0, the package lacked proper validation for URLs, making it susceptible to security vulnerabilities.
Vulnerability Detail
The czim/file-handling package is vulnerable to Server-Side Request Forgery (SSRF) and directory traversal attacks due to inadequate URL validation in its makeFromUrl and makeFromAny functions. This flaw allows attackers to manipulate the input to access local files or external resources, potentially leading to unauthorized data exposure or system compromise. The vulnerability is classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and CWE-918 (Server-Side Request Forgery).
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
< 1.5.01.5.0composer require czim/file-handling:1.5.0 -
>= 2.0.0, < 2.3.02.3.0composer require czim/file-handling:2.3.0
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
If immediate upgrading is not feasible, consider implementing input validation on URLs before passing them to the czim/file-handling functions. Ensure that only trusted URLs are processed and restrict access to local file paths.
Conclusion
The czim/file-handling package is vulnerable to SSRF and directory traversal attacks due to insufficient URL validation. It is crucial to update to the latest versions to mitigate these risks and ensure the security of your application.
See every vulnerability recorded for czim/file-handling →
FAQ
Server-Side Request Forgery (SSRF) is a vulnerability that allows an attacker to send crafted requests from the server to internal or external resources, potentially leading to unauthorized access.
Directory traversal attacks enable attackers to access files and directories outside the intended directory, which can lead to sensitive data exposure or system compromise.
Failing to address this vulnerability may expose your application to data breaches, unauthorized access, and potential exploitation by malicious actors.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.
The CVSS score of this vulnerability is 6.5, indicating a moderate level of severity.